Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 1260183008: Order jump tables for deterministic or randomized emission. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix sort comparison. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceSwitchLowering.h ('k') | src/IceTargetLoweringX8664.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 emitConstantPool<PoolTypeConverter<float>>(Ctx); 236 emitConstantPool<PoolTypeConverter<float>>(Ctx);
237 emitConstantPool<PoolTypeConverter<double>>(Ctx); 237 emitConstantPool<PoolTypeConverter<double>>(Ctx);
238 } break; 238 } break;
239 } 239 }
240 } 240 }
241 241
242 void TargetDataX8632::lowerJumpTables() { 242 void TargetDataX8632::lowerJumpTables() {
243 switch (Ctx->getFlags().getOutFileType()) { 243 switch (Ctx->getFlags().getOutFileType()) {
244 case FT_Elf: { 244 case FT_Elf: {
245 ELFObjectWriter *Writer = Ctx->getObjectWriter(); 245 ELFObjectWriter *Writer = Ctx->getObjectWriter();
246 for (const JumpTableData &JumpTable : *Ctx->getJumpTables()) 246 for (const JumpTableData &JT : Ctx->getJumpTables())
247 Writer->writeJumpTable(JumpTable, llvm::ELF::R_386_32); 247 Writer->writeJumpTable(JT, llvm::ELF::R_386_32);
248 } break; 248 } break;
249 case FT_Asm: 249 case FT_Asm:
250 // Already emitted from Cfg 250 // Already emitted from Cfg
251 break; 251 break;
252 case FT_Iasm: { 252 case FT_Iasm: {
253 if (!BuildDefs::dump()) 253 if (!BuildDefs::dump())
254 return; 254 return;
255 Ostream &Str = Ctx->getStrEmit(); 255 Ostream &Str = Ctx->getStrEmit();
256 for (const JumpTableData &JT : *Ctx->getJumpTables()) { 256 for (const JumpTableData &JT : Ctx->getJumpTables()) {
257 Str << "\t.section\t.rodata." << JT.getFunctionName() 257 Str << "\t.section\t.rodata." << JT.getFunctionName()
258 << "$jumptable,\"a\",@progbits\n"; 258 << "$jumptable,\"a\",@progbits\n";
259 Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n"; 259 Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n";
260 Str << InstJumpTable::makeName(JT.getFunctionName(), JT.getId()) << ":"; 260 Str << InstJumpTable::makeName(JT.getFunctionName(), JT.getId()) << ":";
261 261
262 // On X8632 pointers are 32-bit hence the use of .long 262 // On X8632 pointers are 32-bit hence the use of .long
263 for (intptr_t TargetOffset : JT.getTargetOffsets()) 263 for (intptr_t TargetOffset : JT.getTargetOffsets())
264 Str << "\n\t.long\t" << JT.getFunctionName() << "+" << TargetOffset; 264 Str << "\n\t.long\t" << JT.getFunctionName() << "+" << TargetOffset;
265 Str << "\n"; 265 Str << "\n";
266 } 266 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 // entries in case the high-level table has extra entries. 393 // entries in case the high-level table has extra entries.
394 #define X(tag, sizeLog2, align, elts, elty, str) \ 394 #define X(tag, sizeLog2, align, elts, elty, str) \
395 static_assert(_table1_##tag == _table2_##tag, \ 395 static_assert(_table1_##tag == _table2_##tag, \
396 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); 396 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE");
397 ICETYPE_TABLE 397 ICETYPE_TABLE
398 #undef X 398 #undef X
399 } // end of namespace dummy3 399 } // end of namespace dummy3
400 } // end of anonymous namespace 400 } // end of anonymous namespace
401 401
402 } // end of namespace Ice 402 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceSwitchLowering.h ('k') | src/IceTargetLoweringX8664.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698