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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 1206723003: Function Layout, Global Variable Layout and Pooled Constants Layout Reordering (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 5 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/IceGlobalInits.cpp ('k') | src/IceTargetLoweringX86BaseImpl.h » ('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 //===----------------------------------------------------------------------===// 5 //===----------------------------------------------------------------------===//
6 // 6 //
7 // This file implements the TargetLoweringX8632 class, which 7 // This file implements the TargetLoweringX8632 class, which
8 // consists almost entirely of the lowering sequence for each 8 // consists almost entirely of the lowering sequence for each
9 // high-level instruction. 9 // high-level instruction.
10 // 10 //
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if (!BuildDefs::dump()) 232 if (!BuildDefs::dump())
233 return; 233 return;
234 Ostream &Str = Ctx->getStrEmit(); 234 Ostream &Str = Ctx->getStrEmit();
235 Type Ty = T::Ty; 235 Type Ty = T::Ty;
236 SizeT Align = typeAlignInBytes(Ty); 236 SizeT Align = typeAlignInBytes(Ty);
237 ConstantList Pool = Ctx->getConstantPool(Ty); 237 ConstantList Pool = Ctx->getConstantPool(Ty);
238 238
239 Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",@progbits," << Align 239 Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",@progbits," << Align
240 << "\n"; 240 << "\n";
241 Str << "\t.align\t" << Align << "\n"; 241 Str << "\t.align\t" << Align << "\n";
242
243 // If reorder-pooled-constants option is set to true, we need to shuffle the
244 // constant pool before emitting it.
245 if (Ctx->getFlags().shouldReorderPooledConstants())
246 RandomShuffle(Pool.begin(), Pool.end(), [Ctx](uint64_t N) {
247 return (uint32_t)Ctx->getRNG().next(N);
248 });
249
242 for (Constant *C : Pool) { 250 for (Constant *C : Pool) {
243 if (!C->getShouldBePooled()) 251 if (!C->getShouldBePooled())
244 continue; 252 continue;
245 typename T::IceType *Const = llvm::cast<typename T::IceType>(C); 253 typename T::IceType *Const = llvm::cast<typename T::IceType>(C);
246 typename T::IceType::PrimType Value = Const->getValue(); 254 typename T::IceType::PrimType Value = Const->getValue();
247 // Use memcpy() to copy bits from Value into RawValue in a way 255 // Use memcpy() to copy bits from Value into RawValue in a way
248 // that avoids breaking strict-aliasing rules. 256 // that avoids breaking strict-aliasing rules.
249 typename T::PrimitiveIntType RawValue; 257 typename T::PrimitiveIntType RawValue;
250 memcpy(&RawValue, &Value, sizeof(Value)); 258 memcpy(&RawValue, &Value, sizeof(Value));
251 char buf[30]; 259 char buf[30];
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 // entries in case the high-level table has extra entries. 423 // entries in case the high-level table has extra entries.
416 #define X(tag, size, align, elts, elty, str) \ 424 #define X(tag, size, align, elts, elty, str) \
417 static_assert(_table1_##tag == _table2_##tag, \ 425 static_assert(_table1_##tag == _table2_##tag, \
418 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); 426 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE");
419 ICETYPE_TABLE 427 ICETYPE_TABLE
420 #undef X 428 #undef X
421 } // end of namespace dummy3 429 } // end of namespace dummy3
422 } // end of anonymous namespace 430 } // end of anonymous namespace
423 431
424 } // end of namespace Ice 432 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalInits.cpp ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698