39 #define DEBUG_TYPE "wasm-call-indirect-fixup" 44 return "WebAssembly CallIndirect Fixup";
57 "Rewrite call_indirect argument orderings",
false,
false)
60 return new WebAssemblyCallIndirectFixup();
65 using namespace WebAssembly;
66 case PCALL_INDIRECT_VOID:
67 return CALL_INDIRECT_VOID;
68 case PCALL_INDIRECT_i32:
69 return CALL_INDIRECT_i32;
70 case PCALL_INDIRECT_i64:
71 return CALL_INDIRECT_i64;
72 case PCALL_INDIRECT_f32:
73 return CALL_INDIRECT_f32;
74 case PCALL_INDIRECT_f64:
75 return CALL_INDIRECT_f64;
76 case PCALL_INDIRECT_v16i8:
77 return CALL_INDIRECT_v16i8;
78 case PCALL_INDIRECT_v8i16:
79 return CALL_INDIRECT_v8i16;
80 case PCALL_INDIRECT_v4i32:
81 return CALL_INDIRECT_v4i32;
82 case PCALL_INDIRECT_v2i64:
83 return CALL_INDIRECT_v2i64;
84 case PCALL_INDIRECT_v4f32:
85 return CALL_INDIRECT_v4f32;
86 case PCALL_INDIRECT_v2f64:
87 return CALL_INDIRECT_v2f64;
88 case PCALL_INDIRECT_exnref:
89 return CALL_INDIRECT_exnref;
90 case PRET_CALL_INDIRECT:
91 return RET_CALL_INDIRECT;
93 return INSTRUCTION_LIST_END;
99 WebAssembly::INSTRUCTION_LIST_END;
102 bool WebAssemblyCallIndirectFixup::runOnMachineFunction(
MachineFunction &MF) {
103 LLVM_DEBUG(
dbgs() <<
"********** Fixing up CALL_INDIRECTs **********\n" 104 <<
"********** Function: " << MF.
getName() <<
'\n');
106 bool Changed =
false;
131 MI.operands_begin() +
MI.getNumExplicitOperands()))
136 while (
MI.getNumOperands() >
MI.getDesc().getNumDefs())
137 MI.RemoveOperand(
MI.getNumOperands() - 1);
static bool isPseudoCallIndirect(const MachineInstr &MI)
This class represents lattice values for constants.
void push_back(const T &Elt)
Describe properties that are true of each instruction in the target description file.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
FunctionPass * createWebAssemblyCallIndirectFixup()
This file provides WebAssembly-specific target descriptions.
FunctionPass class - This class is used to implement most global optimizations.
static unsigned getNonPseudoCallIndirectOpcode(const MachineInstr &MI)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
This file declares the WebAssembly-specific subclass of TargetSubtarget.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Representation of each machine instruction.
static MachineOperand CreateImm(int64_t Val)
This file declares WebAssembly-specific per-machine-function information.
INITIALIZE_PASS(WebAssemblyCallIndirectFixup, DEBUG_TYPE, "Rewrite call_indirect argument orderings", false, false) FunctionPass *llvm
StringRef - Represent a constant reference to a string, i.e.