|
24 | 24 | #include "WebAssemblyMachineFunctionInfo.h" |
25 | 25 | #include "WebAssemblyRegisterInfo.h" |
26 | 26 | #include "WebAssemblyRuntimeLibcallSignatures.h" |
| 27 | +#include "WebAssemblyTargetMachine.h" |
27 | 28 | #include "WebAssemblyUtilities.h" |
28 | 29 | #include "llvm/ADT/MapVector.h" |
29 | 30 | #include "llvm/ADT/SmallSet.h" |
@@ -155,9 +156,11 @@ static std::string getEmscriptenInvokeSymbolName(wasm::WasmSignature *Sig) { |
155 | 156 | //===----------------------------------------------------------------------===// |
156 | 157 |
|
157 | 158 | MCSymbolWasm *WebAssemblyAsmPrinter::getMCSymbolForFunction( |
158 | | - const Function *F, bool EnableEmEH, wasm::WasmSignature *Sig, |
159 | | - bool &InvokeDetected) { |
| 159 | + const Function *F, wasm::WasmSignature *Sig, bool &InvokeDetected) { |
160 | 160 | MCSymbolWasm *WasmSym = nullptr; |
| 161 | + |
| 162 | + const bool EnableEmEH = |
| 163 | + WebAssembly::WasmEnableEmEH || WebAssembly::WasmEnableEmSjLj; |
161 | 164 | if (EnableEmEH && isEmscriptenInvokeName(F->getName())) { |
162 | 165 | assert(Sig); |
163 | 166 | InvokeDetected = true; |
@@ -344,9 +347,7 @@ void WebAssemblyAsmPrinter::emitDecls(const Module &M) { |
344 | 347 | // will discard it later if it turns out not to be necessary. |
345 | 348 | auto Signature = signatureFromMVTs(OutContext, Results, Params); |
346 | 349 | bool InvokeDetected = false; |
347 | | - auto *Sym = getMCSymbolForFunction( |
348 | | - &F, WebAssembly::WasmEnableEmEH || WebAssembly::WasmEnableEmSjLj, |
349 | | - Signature, InvokeDetected); |
| 350 | + auto *Sym = getMCSymbolForFunction(&F, Signature, InvokeDetected); |
350 | 351 |
|
351 | 352 | // Multiple functions can be mapped to the same invoke symbol. For |
352 | 353 | // example, two IR functions '__invoke_void_i8*' and '__invoke_void_i32' |
@@ -404,7 +405,7 @@ void WebAssemblyAsmPrinter::emitEndOfAsmFile(Module &M) { |
404 | 405 | if (!F.isIntrinsic() && F.hasAddressTaken()) { |
405 | 406 | MCSymbolWasm *FunctionTable = |
406 | 407 | WebAssembly::getOrCreateFunctionTableSymbol(OutContext, Subtarget); |
407 | | - OutStreamer->emitSymbolAttribute(FunctionTable, MCSA_NoDeadStrip); |
| 408 | + OutStreamer->emitSymbolAttribute(FunctionTable, MCSA_NoDeadStrip); |
408 | 409 | break; |
409 | 410 | } |
410 | 411 | } |
|
0 commit comments