| Index: src/IceTargetLoweringX8632.cpp
|
| diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
|
| index dfa042afc82debbc05d00843a42da695c4cb01ed..e8e89dd88f7429931fcf2fe07382eca35f350dcf 100644
|
| --- a/src/IceTargetLoweringX8632.cpp
|
| +++ b/src/IceTargetLoweringX8632.cpp
|
| @@ -151,6 +151,23 @@ const char *PoolTypeConverter<uint8_t>::AsmTag = ".byte";
|
| const char *PoolTypeConverter<uint8_t>::PrintfString = "0x%x";
|
| } // end of anonymous namespace
|
|
|
| +void TargetX8632::emitJumpTable(const Cfg *Func,
|
| + const InstJumpTable *JumpTable) const {
|
| + if (!BuildDefs::dump())
|
| + return;
|
| + Ostream &Str = Ctx->getStrEmit();
|
| + IceString MangledName = Ctx->mangleName(Func->getFunctionName());
|
| + Str << "\t.section\t.rodata." << MangledName
|
| + << "$jumptable,\"a\",@progbits\n";
|
| + Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n";
|
| + Str << InstJumpTable::makeName(MangledName, JumpTable->getId()) << ":";
|
| +
|
| + // On X8632 pointers are 32-bit hence the use of .long
|
| + for (SizeT I = 0; I < JumpTable->getNumTargets(); ++I)
|
| + Str << "\n\t.long\t" << JumpTable->getTarget(I)->getAsmName();
|
| + Str << "\n";
|
| +}
|
| +
|
| template <typename T>
|
| void TargetDataX8632::emitConstantPool(GlobalContext *Ctx) {
|
| if (!BuildDefs::dump())
|
| @@ -222,6 +239,35 @@ void TargetDataX8632::lowerConstants() {
|
| }
|
| }
|
|
|
| +void TargetDataX8632::lowerJumpTables() {
|
| + switch (Ctx->getFlags().getOutFileType()) {
|
| + case FT_Elf: {
|
| + ELFObjectWriter *Writer = Ctx->getObjectWriter();
|
| + for (const JumpTableData &JumpTable : *Ctx->getJumpTables())
|
| + Writer->writeJumpTable(JumpTable, llvm::ELF::R_386_32);
|
| + } break;
|
| + case FT_Asm:
|
| + // Already emitted from Cfg
|
| + break;
|
| + case FT_Iasm: {
|
| + if (!BuildDefs::dump())
|
| + return;
|
| + Ostream &Str = Ctx->getStrEmit();
|
| + for (const JumpTableData &JT : *Ctx->getJumpTables()) {
|
| + Str << "\t.section\t.rodata." << JT.getFunctionName()
|
| + << "$jumptable,\"a\",@progbits\n";
|
| + Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n";
|
| + Str << InstJumpTable::makeName(JT.getFunctionName(), JT.getId()) << ":";
|
| +
|
| + // On X8632 pointers are 32-bit hence the use of .long
|
| + for (intptr_t TargetOffset : JT.getTargetOffsets())
|
| + Str << "\n\t.long\t" << JT.getFunctionName() << "+" << TargetOffset;
|
| + Str << "\n";
|
| + }
|
| + } break;
|
| + }
|
| +}
|
| +
|
| void TargetDataX8632::lowerGlobals(const VariableDeclarationList &Vars,
|
| const IceString &SectionSuffix) {
|
| switch (Ctx->getFlags().getOutFileType()) {
|
|
|