mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-03 09:57:24 +00:00
[WebAssembly] Rename wasm fixup kinds
These fixup kinds are not explicitly related to the code section. They are there to signal how to apply the fixup. Also, a couple of other minor wasm cleanups. Differential Revision: https://reviews.llvm.org/D59908 llvm-svn: 357145
This commit is contained in:
parent
1c82b308b0
commit
fbd1124aba
@ -269,9 +269,6 @@ class WasmObjectWriter : public MCObjectWriter {
|
||||
|
||||
// TargetObjectWriter wrappers.
|
||||
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
|
||||
unsigned getRelocType(const MCValue &Target, const MCFixup &Fixup) const {
|
||||
return TargetObjectWriter->getRelocType(Target, Fixup);
|
||||
}
|
||||
|
||||
void startSection(SectionBookkeeping &Section, unsigned SectionId);
|
||||
void startCustomSection(SectionBookkeeping &Section, StringRef Name);
|
||||
@ -508,7 +505,7 @@ void WasmObjectWriter::recordRelocation(MCAssembler &Asm,
|
||||
// be negative and don't wrap.
|
||||
FixedValue = 0;
|
||||
|
||||
unsigned Type = getRelocType(Target, Fixup);
|
||||
unsigned Type = TargetObjectWriter->getRelocType(Target, Fixup);
|
||||
assert(!IsPCRel);
|
||||
assert(SymA);
|
||||
|
||||
|
@ -75,9 +75,9 @@ WebAssemblyAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
|
||||
// WebAssemblyFixupKinds.h.
|
||||
//
|
||||
// Name Offset (bits) Size (bits) Flags
|
||||
{"fixup_code_sleb128_i32", 0, 5 * 8, 0},
|
||||
{"fixup_code_sleb128_i64", 0, 10 * 8, 0},
|
||||
{"fixup_code_uleb128_i32", 0, 5 * 8, 0},
|
||||
{"fixup_sleb128_i32", 0, 5 * 8, 0},
|
||||
{"fixup_sleb128_i64", 0, 10 * 8, 0},
|
||||
{"fixup_uleb128_i32", 0, 5 * 8, 0},
|
||||
};
|
||||
|
||||
if (Kind < FirstTargetFixupKind)
|
||||
|
@ -14,9 +14,9 @@
|
||||
namespace llvm {
|
||||
namespace WebAssembly {
|
||||
enum Fixups {
|
||||
fixup_code_sleb128_i32 = FirstTargetFixupKind, // 32-bit signed
|
||||
fixup_code_sleb128_i64, // 64-bit signed
|
||||
fixup_code_uleb128_i32, // 32-bit unsigned
|
||||
fixup_sleb128_i32 = FirstTargetFixupKind, // 32-bit signed
|
||||
fixup_sleb128_i64, // 64-bit signed
|
||||
fixup_uleb128_i32, // 32-bit unsigned
|
||||
|
||||
// Marker
|
||||
LastTargetFixupKind,
|
||||
|
@ -144,10 +144,10 @@ void WebAssemblyMCCodeEmitter::encodeInstruction(
|
||||
size_t PaddedSize = 5;
|
||||
switch (Info.OperandType) {
|
||||
case WebAssembly::OPERAND_I32IMM:
|
||||
FixupKind = MCFixupKind(WebAssembly::fixup_code_sleb128_i32);
|
||||
FixupKind = MCFixupKind(WebAssembly::fixup_sleb128_i32);
|
||||
break;
|
||||
case WebAssembly::OPERAND_I64IMM:
|
||||
FixupKind = MCFixupKind(WebAssembly::fixup_code_sleb128_i64);
|
||||
FixupKind = MCFixupKind(WebAssembly::fixup_sleb128_i64);
|
||||
PaddedSize = 10;
|
||||
break;
|
||||
case WebAssembly::OPERAND_FUNCTION32:
|
||||
@ -155,7 +155,7 @@ void WebAssemblyMCCodeEmitter::encodeInstruction(
|
||||
case WebAssembly::OPERAND_TYPEINDEX:
|
||||
case WebAssembly::OPERAND_GLOBAL:
|
||||
case WebAssembly::OPERAND_EVENT:
|
||||
FixupKind = MCFixupKind(WebAssembly::fixup_code_uleb128_i32);
|
||||
FixupKind = MCFixupKind(WebAssembly::fixup_uleb128_i32);
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("unexpected symbolic operand kind");
|
||||
|
@ -76,13 +76,13 @@ unsigned WebAssemblyWasmObjectWriter::getRelocType(const MCValue &Target,
|
||||
auto& SymA = cast<MCSymbolWasm>(RefA->getSymbol());
|
||||
|
||||
switch (unsigned(Fixup.getKind())) {
|
||||
case WebAssembly::fixup_code_sleb128_i32:
|
||||
case WebAssembly::fixup_sleb128_i32:
|
||||
if (SymA.isFunction())
|
||||
return wasm::R_WASM_TABLE_INDEX_SLEB;
|
||||
return wasm::R_WASM_MEMORY_ADDR_SLEB;
|
||||
case WebAssembly::fixup_code_sleb128_i64:
|
||||
case WebAssembly::fixup_sleb128_i64:
|
||||
llvm_unreachable("fixup_sleb128_i64 not implemented yet");
|
||||
case WebAssembly::fixup_code_uleb128_i32:
|
||||
case WebAssembly::fixup_uleb128_i32:
|
||||
if (SymA.isGlobal() || isGOTRef(RefA))
|
||||
return wasm::R_WASM_GLOBAL_INDEX_LEB;
|
||||
if (SymA.isFunction()) {
|
||||
@ -105,8 +105,6 @@ unsigned WebAssemblyWasmObjectWriter::getRelocType(const MCValue &Target,
|
||||
return wasm::R_WASM_SECTION_OFFSET_I32;
|
||||
}
|
||||
return wasm::R_WASM_MEMORY_ADDR_I32;
|
||||
case FK_Data_8:
|
||||
llvm_unreachable("FK_Data_8 not implemented yet");
|
||||
default:
|
||||
llvm_unreachable("unimplemented fixup kind");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user