Skip to content

Commit ead837a

Browse files
jrtc27resistor
authored andcommitted
[Transforms] Move createLogCheriSetBoundsPass to Transforms/Utils.h
This lets us drop dependencies on any CodeGen headers. Also add a LogCheriSetBoundsID like the other passes.
1 parent 27ad2e8 commit ead837a

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

llvm/include/llvm/CodeGen/Passes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,6 @@ namespace llvm {
514514
/// This pass performs merging similar functions globally.
515515
ModulePass *createGlobalMergeFuncPass();
516516

517-
/// This pass logs information on generated CSetBounds calls
518-
FunctionPass *createLogCheriSetBoundsPass();
519-
520517
/// This pass performs outlining on machine instructions directly before
521518
/// printing assembly.
522519
ModulePass *createMachineOutlinerPass(bool RunOnAllFunctions = true);

llvm/include/llvm/Transforms/Utils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ class ModulePass;
2020
class FunctionPass;
2121
class Pass;
2222

23+
//===----------------------------------------------------------------------===//
24+
// LogCheriSetBounds - This pass logs information on generated CSetBounds
25+
// calls.
26+
//
27+
FunctionPass *createLogCheriSetBoundsPass();
28+
extern char &LogCheriSetBoundsID;
29+
2330
//===----------------------------------------------------------------------===//
2431
//
2532
// LowerInvoke - This pass removes invoke instructions, converting them to call

llvm/lib/Transforms/Utils/CheriLogSetBoundsPass.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#include "llvm/Transforms/Utils/CheriLogSetBounds.h"
11-
1210
#include "llvm/Analysis/AssumptionCache.h"
13-
#include "llvm/CodeGen/MachineFunctionPass.h"
14-
#include "llvm/CodeGen/MachineModuleInfo.h"
15-
#include "llvm/CodeGen/Passes.h"
1611
#include "llvm/IR/Module.h"
12+
#include "llvm/Transforms/Utils.h"
13+
#include "llvm/Transforms/Utils/CheriLogSetBounds.h"
1714
#include "llvm/Transforms/Utils/CheriSetBounds.h"
1815
#include "llvm/Transforms/Utils/Local.h"
1916

@@ -137,12 +134,16 @@ class CheriLogSetBoundsLegacyPass : public FunctionPass {
137134

138135
char CheriLogSetBoundsLegacyPass::ID;
139136

140-
FunctionPass *llvm::createLogCheriSetBoundsPass() {
137+
namespace llvm {
138+
char &LogCheriSetBoundsID = CheriLogSetBoundsLegacyPass::ID;
139+
140+
FunctionPass *createLogCheriSetBoundsPass() {
141141
static bool created = false;
142142
assert(!created && "Should only be created once");
143143
created = true;
144144
return new CheriLogSetBoundsLegacyPass();
145145
}
146+
} // namespace llvm
146147

147148
PreservedAnalyses CheriLogSetBoundsPass::run(Function &F,
148149
FunctionAnalysisManager &AM) {

0 commit comments

Comments
 (0)