LLVM: lib/Target/WebAssembly/WebAssemblyCleanCodeAfterTrap.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
24using namespace llvm;
25
26#define DEBUG_TYPE "wasm-clean-code-after-trap"
27
28namespace {
30public:
31 static char ID;
33
34 StringRef getPassName() const override {
35 return "WebAssembly Clean Code After Trap";
36 }
37
39};
40}
41
42char WebAssemblyCleanCodeAfterTrap::ID = 0;
44 "WebAssembly Clean Code After Trap", false, false)
45
47 return new WebAssemblyCleanCodeAfterTrap();
48}
49
50bool WebAssemblyCleanCodeAfterTrap::runOnMachineFunction(MachineFunction &MF) {
52 dbgs() << "********** CleanCodeAfterTrap **********\n"
53 << "********** Function: " << MF.getName() << '\n';
54 });
55
57
58 for (MachineBasicBlock &BB : MF) {
59 bool HasTerminator = false;
61 for (MachineInstr &MI : BB) {
62 if (HasTerminator)
65 HasTerminator = true;
66 }
67 if (!RemoveMI.empty()) {
70 for (MachineInstr *MI : RemoveMI) {
73 }
74 });
75 for (MachineInstr *MI : RemoveMI)
76 MI->eraseFromParent();
77 }
78 }
80}
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
This file contains the declaration of the WebAssembly-specific utility functions.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
FunctionPass class - This class is used to implement most global optimizations.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
void push_back(const T &Elt)
StringRef - Represent a constant reference to a string, i.e.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
FunctionPass * createWebAssemblyCleanCodeAfterTrap()