Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | MCSymbol *WebAssemblyMCInstLower::GetExternalSymbolSymbol( | ||||
const char *Name = MO.getSymbolName(); | const char *Name = MO.getSymbolName(); | ||||
auto *WasmSym = cast<MCSymbolWasm>(Printer.GetExternalSymbolSymbol(Name)); | auto *WasmSym = cast<MCSymbolWasm>(Printer.GetExternalSymbolSymbol(Name)); | ||||
const WebAssemblySubtarget &Subtarget = Printer.getSubtarget(); | const WebAssemblySubtarget &Subtarget = Printer.getSubtarget(); | ||||
// Except for certain known symbols, all symbols used by CodeGen are | // Except for certain known symbols, all symbols used by CodeGen are | ||||
// functions. It's OK to hardcode knowledge of specific symbols here; this | // functions. It's OK to hardcode knowledge of specific symbols here; this | ||||
// method is precisely there for fetching the signatures of known | // method is precisely there for fetching the signatures of known | ||||
// Clang-provided symbols. | // Clang-provided symbols. | ||||
if (strcmp(Name, "__stack_pointer") == 0 || | if (strcmp(Name, "__stack_pointer") == 0 || strcmp(Name, "__tls_base") == 0 || | ||||
strcmp(Name, "__memory_base") == 0 || strcmp(Name, "__table_base") == 0) { | strcmp(Name, "__memory_base") == 0 || strcmp(Name, "__table_base") == 0 || | ||||
bool Mutable = strcmp(Name, "__stack_pointer") == 0; | strcmp(Name, "__tls_size") == 0) { | ||||
bool Mutable = | |||||
strcmp(Name, "__stack_pointer") == 0 || strcmp(Name, "__tls_base") == 0; | |||||
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL); | WasmSym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL); | ||||
WasmSym->setGlobalType(wasm::WasmGlobalType{ | WasmSym->setGlobalType(wasm::WasmGlobalType{ | ||||
uint8_t(Subtarget.hasAddr64() ? wasm::WASM_TYPE_I64 | uint8_t(Subtarget.hasAddr64() ? wasm::WASM_TYPE_I64 | ||||
: wasm::WASM_TYPE_I32), | : wasm::WASM_TYPE_I32), | ||||
Mutable}); | Mutable}); | ||||
return WasmSym; | return WasmSym; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |