| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // On X8664 ILP32 pointers are 32-bit hence the use of .long | 233 // On X8664 ILP32 pointers are 32-bit hence the use of .long |
| 234 for (SizeT I = 0; I < JumpTable->getNumTargets(); ++I) | 234 for (SizeT I = 0; I < JumpTable->getNumTargets(); ++I) |
| 235 Str << "\n\t.long\t" << JumpTable->getTarget(I)->getAsmName(); | 235 Str << "\n\t.long\t" << JumpTable->getTarget(I)->getAsmName(); |
| 236 Str << "\n"; | 236 Str << "\n"; |
| 237 } | 237 } |
| 238 | 238 |
| 239 void TargetDataX8664::lowerJumpTables() { | 239 void TargetDataX8664::lowerJumpTables() { |
| 240 switch (Ctx->getFlags().getOutFileType()) { | 240 switch (Ctx->getFlags().getOutFileType()) { |
| 241 case FT_Elf: { | 241 case FT_Elf: { |
| 242 ELFObjectWriter *Writer = Ctx->getObjectWriter(); | 242 ELFObjectWriter *Writer = Ctx->getObjectWriter(); |
| 243 for (const JumpTableData &JumpTable : *Ctx->getJumpTables()) | 243 for (const JumpTableData &JT : Ctx->getJumpTables()) |
| 244 // TODO(jpp): not 386. | 244 // TODO(jpp): not 386. |
| 245 Writer->writeJumpTable(JumpTable, llvm::ELF::R_386_32); | 245 Writer->writeJumpTable(JT, llvm::ELF::R_386_32); |
| 246 } break; | 246 } break; |
| 247 case FT_Asm: | 247 case FT_Asm: |
| 248 // Already emitted from Cfg | 248 // Already emitted from Cfg |
| 249 break; | 249 break; |
| 250 case FT_Iasm: { | 250 case FT_Iasm: { |
| 251 if (!BuildDefs::dump()) | 251 if (!BuildDefs::dump()) |
| 252 return; | 252 return; |
| 253 Ostream &Str = Ctx->getStrEmit(); | 253 Ostream &Str = Ctx->getStrEmit(); |
| 254 for (const JumpTableData &JT : *Ctx->getJumpTables()) { | 254 for (const JumpTableData &JT : Ctx->getJumpTables()) { |
| 255 Str << "\t.section\t.rodata." << JT.getFunctionName() | 255 Str << "\t.section\t.rodata." << JT.getFunctionName() |
| 256 << "$jumptable,\"a\",@progbits\n"; | 256 << "$jumptable,\"a\",@progbits\n"; |
| 257 Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n"; | 257 Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n"; |
| 258 Str << InstJumpTable::makeName(JT.getFunctionName(), JT.getId()) << ":"; | 258 Str << InstJumpTable::makeName(JT.getFunctionName(), JT.getId()) << ":"; |
| 259 | 259 |
| 260 // On X8664 ILP32 pointers are 32-bit hence the use of .long | 260 // On X8664 ILP32 pointers are 32-bit hence the use of .long |
| 261 for (intptr_t TargetOffset : JT.getTargetOffsets()) | 261 for (intptr_t TargetOffset : JT.getTargetOffsets()) |
| 262 Str << "\n\t.long\t" << JT.getFunctionName() << "+" << TargetOffset; | 262 Str << "\n\t.long\t" << JT.getFunctionName() << "+" << TargetOffset; |
| 263 Str << "\n"; | 263 Str << "\n"; |
| 264 } | 264 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // entries in case the high-level table has extra entries. | 389 // entries in case the high-level table has extra entries. |
| 390 #define X(tag, sizeLog2, align, elts, elty, str) \ | 390 #define X(tag, sizeLog2, align, elts, elty, str) \ |
| 391 static_assert(_table1_##tag == _table2_##tag, \ | 391 static_assert(_table1_##tag == _table2_##tag, \ |
| 392 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); | 392 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); |
| 393 ICETYPE_TABLE | 393 ICETYPE_TABLE |
| 394 #undef X | 394 #undef X |
| 395 } // end of namespace dummy3 | 395 } // end of namespace dummy3 |
| 396 } // end of anonymous namespace | 396 } // end of anonymous namespace |
| 397 | 397 |
| 398 } // end of namespace Ice | 398 } // end of namespace Ice |
| OLD | NEW |