File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ #include " X86.h"
2+ #include " llvm/CodeGen/MachineFunctionPass.h"
3+ #include " llvm/CodeGen/MachineInstr.h"
4+ #include " llvm/CodeGen/MachineRegisterInfo.h"
5+ #include " llvm/Support/Debug.h"
6+ #include " llvm/Support/raw_ostream.h"
7+
8+
9+ using namespace llvm ;
10+
11+ namespace {
12+ class X86MatchJumptablePass : public MachineFunctionPass {
13+ public:
14+ static char ID;
15+
16+ X86MatchJumptablePass () : MachineFunctionPass(ID) {}
17+
18+ bool runOnMachineFunction (MachineFunction &MF) override {
19+ LLVM_DEBUG (dbgs () << " Running X86MyBackendPass on function: "
20+ << MF.getName () << " \n " );
21+
22+ // Example: Iterate through instructions
23+ for (auto &MBB : MF) {
24+ for (auto &MI : MBB) {
25+ // Process instructions here
26+ LLVM_DEBUG (dbgs () << " Instruction: " << MI << " \n " );
27+ }
28+ }
29+
30+ return false ; // Return true if the pass modifies the function
31+ }
32+
33+ StringRef getPassName () const override {
34+ return " X86 My Backend Pass" ;
35+ }
36+ };
37+ }
38+
39+ char X86MatchJumptablePass::ID = 0 ;
40+
41+ // Register the pass
42+ FunctionPass *llvm::createX86MatchJumptablePass () {
43+ return new X86MatchJumptablePass ();
44+ }
You can’t perform that action at this time.
0 commit comments