1- // ===-- EHContGuardCatchret .cpp - Catchret target symbols ------ -*- C++ -*-===//
1+ // ===-- EHContGuardTargets .cpp - EH continuation target symbols -*- C++ -*-===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
88// /
99// / \file
1010// / This file contains a machine function pass to insert a symbol before each
11- // / valid catchret target and store this in the MachineFunction's
12- // / CatchRetTargets vector. This will be used to emit the table of valid targets
13- // / used by EHCont Guard.
11+ // / valid target where the unwinder in Windows may continue exectution after an
12+ // / exception is thrown and store this in the MachineFunction's EHContTargets
13+ // / vector. This will be used to emit the table of valid targets used by Windows
14+ // / EH Continuation Guard.
1415// /
1516// ===----------------------------------------------------------------------===//
1617
@@ -26,19 +27,18 @@ using namespace llvm;
2627
2728#define DEBUG_TYPE " ehcontguard-catchret"
2829
29- STATISTIC (EHContGuardCatchretTargets,
30- " Number of EHCont Guard catchret targets" );
30+ STATISTIC (EHContGuardTargetsFound, " Number of EHCont Guard targets" );
3131
3232namespace {
3333
3434// / MachineFunction pass to insert a symbol before each valid catchret target
3535// / and store these in the MachineFunction's CatchRetTargets vector.
36- class EHContGuardCatchret : public MachineFunctionPass {
36+ class EHContGuardTargets : public MachineFunctionPass {
3737public:
3838 static char ID;
3939
40- EHContGuardCatchret () : MachineFunctionPass(ID) {
41- initializeEHContGuardCatchretPass (*PassRegistry::getPassRegistry ());
40+ EHContGuardTargets () : MachineFunctionPass(ID) {
41+ initializeEHContGuardTargetsPass (*PassRegistry::getPassRegistry ());
4242 }
4343
4444 StringRef getPassName () const override {
@@ -50,31 +50,31 @@ class EHContGuardCatchret : public MachineFunctionPass {
5050
5151} // end anonymous namespace
5252
53- char EHContGuardCatchret ::ID = 0 ;
53+ char EHContGuardTargets ::ID = 0 ;
5454
55- INITIALIZE_PASS (EHContGuardCatchret , " EHContGuardCatchret " ,
56- " Insert symbols at valid catchret targets for /guard:ehcont" ,
57- false , false )
58- FunctionPass *llvm::createEHContGuardCatchretPass () {
59- return new EHContGuardCatchret ();
55+ INITIALIZE_PASS (EHContGuardTargets , " EHContGuardTargets " ,
56+ " Insert symbols at valid targets for /guard:ehcont" , false ,
57+ false )
58+ FunctionPass *llvm::createEHContGuardTargetsPass () {
59+ return new EHContGuardTargets ();
6060}
6161
62- bool EHContGuardCatchret ::runOnMachineFunction (MachineFunction &MF) {
62+ bool EHContGuardTargets ::runOnMachineFunction (MachineFunction &MF) {
6363
6464 // Skip modules for which the ehcontguard flag is not set.
6565 if (!MF.getFunction ().getParent ()->getModuleFlag (" ehcontguard" ))
6666 return false ;
6767
68- // Skip functions that do not have catchret
69- if (!MF.hasEHCatchret ())
68+ // Skip functions that do not have targets
69+ if (!MF.hasEHContTarget ())
7070 return false ;
7171
7272 bool Result = false ;
7373
7474 for (MachineBasicBlock &MBB : MF) {
75- if (MBB.isEHCatchretTarget ()) {
76- MF.addCatchretTarget (MBB.getEHCatchretSymbol ());
77- EHContGuardCatchretTargets ++;
75+ if (MBB.isEHContTarget ()) {
76+ MF.addEHContTarget (MBB.getEHContSymbol ());
77+ EHContGuardTargetsFound ++;
7878 Result = true ;
7979 }
8080 }
0 commit comments