mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-05 00:49:43 +00:00
[WebAssembly] Update to match llvm change rL323901. NFC
See: https://reviews.llvm.org/rL323901 Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42751 llvm-svn: 323903
This commit is contained in:
parent
c61c9b6147
commit
1a9b7b911d
@ -172,7 +172,7 @@ InputSegment *ObjFile::getSegment(const WasmSymbol &WasmSym) const {
|
||||
uint32_t ObjFile::getGlobalValue(const WasmSymbol &Sym) const {
|
||||
const WasmGlobal &Global =
|
||||
getWasmObj()->globals()[Sym.ElementIndex - NumGlobalImports];
|
||||
assert(Global.Type == llvm::wasm::WASM_TYPE_I32);
|
||||
assert(Global.Type.Type == llvm::wasm::WASM_TYPE_I32);
|
||||
return Global.InitExpr.Value.Int32;
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ void ObjFile::initializeSymbols() {
|
||||
}
|
||||
|
||||
Symbols.push_back(S);
|
||||
if (WasmSym.isFunction()) {
|
||||
if (WasmSym.isTypeFunction()) {
|
||||
FunctionSymbols[WasmSym.ElementIndex] = S;
|
||||
if (WasmSym.HasAltIndex)
|
||||
FunctionSymbols[WasmSym.AltIndex] = S;
|
||||
@ -301,7 +301,7 @@ Symbol *ObjFile::createUndefined(const WasmSymbol &Sym, Symbol::Kind Kind,
|
||||
Symbol *ObjFile::createDefined(const WasmSymbol &Sym, Symbol::Kind Kind,
|
||||
InputChunk *Chunk, uint32_t Address) {
|
||||
Symbol *S;
|
||||
if (Sym.isLocal()) {
|
||||
if (Sym.isBindingLocal()) {
|
||||
S = make<Symbol>(Sym.Name, true);
|
||||
S->update(Kind, this, Sym.Flags, Chunk, Address);
|
||||
return S;
|
||||
|
@ -236,8 +236,8 @@ void Writer::createGlobalSection() {
|
||||
writeUleb128(OS, DefinedGlobals.size(), "global count");
|
||||
for (const Symbol *Sym : DefinedGlobals) {
|
||||
WasmGlobal Global;
|
||||
Global.Type = WASM_TYPE_I32;
|
||||
Global.Mutable = Sym == Config->StackPointerSymbol;
|
||||
Global.Type.Type = WASM_TYPE_I32;
|
||||
Global.Type.Mutable = Sym == Config->StackPointerSymbol;
|
||||
Global.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
|
||||
Global.InitExpr.Value.Int32 = Sym->getVirtualAddress();
|
||||
writeGlobal(OS, Global);
|
||||
|
@ -123,9 +123,13 @@ void wasm::writeLimits(raw_ostream &OS, const WasmLimits &Limits) {
|
||||
writeUleb128(OS, Limits.Maximum, "limits max");
|
||||
}
|
||||
|
||||
void wasm::writeGlobalType(raw_ostream &OS, const WasmGlobalType &Type) {
|
||||
writeValueType(OS, Type.Type, "global type");
|
||||
writeUleb128(OS, Type.Mutable, "global mutable");
|
||||
}
|
||||
|
||||
void wasm::writeGlobal(raw_ostream &OS, const WasmGlobal &Global) {
|
||||
writeValueType(OS, Global.Type, "global type");
|
||||
writeUleb128(OS, Global.Mutable, "global mutable");
|
||||
writeGlobalType(OS, Global.Type);
|
||||
writeInitExpr(OS, Global.InitExpr);
|
||||
}
|
||||
|
||||
@ -138,8 +142,7 @@ void wasm::writeImport(raw_ostream &OS, const WasmImport &Import) {
|
||||
writeUleb128(OS, Import.SigIndex, "import sig index");
|
||||
break;
|
||||
case WASM_EXTERNAL_GLOBAL:
|
||||
writeValueType(OS, Import.Global.Type, "import global type");
|
||||
writeUleb128(OS, Import.Global.Mutable, "import global mutable");
|
||||
writeGlobalType(OS, Import.Global);
|
||||
break;
|
||||
case WASM_EXTERNAL_MEMORY:
|
||||
writeLimits(OS, Import.Memory);
|
||||
|
@ -60,6 +60,8 @@ void writeInitExpr(raw_ostream &OS, const llvm::wasm::WasmInitExpr &InitExpr);
|
||||
|
||||
void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
|
||||
|
||||
void writeGlobalType(raw_ostream &OS, const llvm::wasm::WasmGlobalType &Type);
|
||||
|
||||
void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
|
||||
|
||||
void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
|
||||
|
Loading…
x
Reference in New Issue
Block a user