Go to the documentation of this file.
26 "enable-emscripten-cxx-exceptions",
27 cl::desc(
"WebAssembly Emscripten-style exception handling"),
31 "enable-emscripten-sjlj",
32 cl::desc(
"WebAssembly Emscripten-style setjmp/longjmp handling"),
37 cl::desc(
"WebAssembly exception handling"),
42 cl::desc(
"WebAssembly setjmp/longjmp handling"),
50 "_Unwind_Wasm_CallPersonality";
55 if (
MI.getNumOperands() == 0)
65 switch (
MI.getOpcode()) {
66 case WebAssembly::THROW:
67 case WebAssembly::THROW_S:
68 case WebAssembly::RETHROW:
69 case WebAssembly::RETHROW_S:
87 if (strcmp(
Name,
"memcpy") == 0 || strcmp(
Name,
"memmove") == 0 ||
88 strcmp(
Name,
"memset") == 0)
93 const auto *
F = dyn_cast<Function>(MO.
getGlobal());
96 if (
F->doesNotThrow())
109 switch (
MI.getOpcode()) {
111 case WebAssembly::CALL_S:
112 case WebAssembly::RET_CALL:
113 case WebAssembly::RET_CALL_S:
114 return MI.getOperand(
MI.getNumExplicitDefs());
115 case WebAssembly::CALL_INDIRECT:
116 case WebAssembly::CALL_INDIRECT_S:
117 case WebAssembly::RET_CALL_INDIRECT:
118 case WebAssembly::RET_CALL_INDIRECT_S:
119 return MI.getOperand(
MI.getNumExplicitOperands() - 1);
172 auto Pos = EHPad->
begin();
175 while (Pos != EHPad->
end() &&
176 (Pos->isLabel() || Pos->isDebugInstr() ||
isMarker(Pos->getOpcode())))
bool isChild(const MachineInstr &MI, const WebAssemblyFunctionInfo &MFI)
Test whether MI is a child of some other node in an expression tree.
const MachineOperand & getCalleeOp(const MachineInstr &MI)
Returns the operand number of a callee, assuming the argument is a call instruction.
This is an optimization pass for GlobalISel generic memory operations.
bool isCatch(unsigned Opc)
MachineInstr * findCatch(MachineBasicBlock *EHPad)
Find a catch instruction from an EH pad.
const GlobalValue * getGlobal() const
Context object for machine code objects.
void setOmitFromLinkingSection()
MCSymbolWasm * getOrCreateFunctionTableSymbol(MCContext &Ctx, const WebAssemblySubtarget *Subtarget)
Returns the __indirect_function_table, for use in call_indirect and in function bitcasts.
Reg
All possible values of the reg field in the ModR/M byte.
bool mayThrow(const MachineInstr &MI)
void setUndefined()
Mark the symbol as undefined.
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isMarker(unsigned Opc)
MCSymbol * lookupSymbol(const Twine &Name) const
Get the symbol for Name, or null.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Represents a location in source code.
cl::opt< bool > WasmEnableEmSjLj
MachineOperand class - Representation of each machine instruction operand.
void setType(wasm::WasmSymbolType type)
const char *const StdTerminateFn
const char *const CxaBeginCatchFn
bool hasReferenceTypes() const
void setTableType(wasm::WasmTableType TT)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Representation of each machine instruction.
const char *const CxaRethrowFn
void setWeak(bool isWeak)
initializer< Ty > init(const Ty &Val)
cl::opt< bool > WasmEnableSjLj
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
bool isVRegStackified(unsigned VReg) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isCallIndirect(unsigned Opc)
void reportError(SMLoc L, const Twine &Msg)
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
Register getReg() const
getReg - Returns the register number.
bool isEHPad() const
Returns true if the block is a landing pad.
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const char *const PersonalityWrapperFn
cl::opt< bool > WasmEnableEH
Wrapper class representing virtual and physical registers.
bool isFunctionTable() const
MCSymbolWasm * getOrCreateFuncrefCallTableSymbol(MCContext &Ctx, const WebAssemblySubtarget *Subtarget)
Returns the __funcref_call_table, for use in funcref calls when lowered to table.set + call_indirect.
const char * getSymbolName() const
cl::opt< bool > WasmEnableEmEH
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.