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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 837553009: Make fixups reference any constant (allow const float/double pool literals). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: go back to one arenaallocator type alias Created 5 years, 11 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/IceOperand.h ('k') | src/assembler.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 // 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 // This file implements the TargetLoweringX8632 class, which 10 // This file implements the TargetLoweringX8632 class, which
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 // Use memcpy() to copy bits from Value into RawValue in a way 1006 // Use memcpy() to copy bits from Value into RawValue in a way
1007 // that avoids breaking strict-aliasing rules. 1007 // that avoids breaking strict-aliasing rules.
1008 typename T::PrimitiveIntType RawValue; 1008 typename T::PrimitiveIntType RawValue;
1009 memcpy(&RawValue, &Value, sizeof(Value)); 1009 memcpy(&RawValue, &Value, sizeof(Value));
1010 char buf[30]; 1010 char buf[30];
1011 int CharsPrinted = 1011 int CharsPrinted =
1012 snprintf(buf, llvm::array_lengthof(buf), T::PrintfString, RawValue); 1012 snprintf(buf, llvm::array_lengthof(buf), T::PrintfString, RawValue);
1013 assert(CharsPrinted >= 0 && 1013 assert(CharsPrinted >= 0 &&
1014 (size_t)CharsPrinted < llvm::array_lengthof(buf)); 1014 (size_t)CharsPrinted < llvm::array_lengthof(buf));
1015 (void)CharsPrinted; // avoid warnings if asserts are disabled 1015 (void)CharsPrinted; // avoid warnings if asserts are disabled
1016 Str << ".L$" << Ty << "$" << Const->getPoolEntryID() << ":\n"; 1016 Const->emitPoolLabel(Str);
1017 Str << "\t" << T::AsmTag << "\t" << buf << "\t# " << T::TypeName << " " 1017 Str << ":\n\t" << T::AsmTag << "\t" << buf << "\t# " << T::TypeName << " "
1018 << Value << "\n"; 1018 << Value << "\n";
1019 } 1019 }
1020 } 1020 }
1021 1021
1022 void TargetX8632::emitConstants() const { 1022 void TargetX8632::emitConstants() const {
1023 // No need to emit constants from the int pool since (for x86) they 1023 // No need to emit constants from the int pool since (for x86) they
1024 // are embedded as immediates in the instructions, just emit float/double. 1024 // are embedded as immediates in the instructions, just emit float/double.
1025 if (Ctx->getFlags().UseELFWriter) { 1025 if (Ctx->getFlags().UseELFWriter) {
1026 ELFObjectWriter *Writer = Ctx->getObjectWriter(); 1026 ELFObjectWriter *Writer = Ctx->getObjectWriter();
1027 Writer->writeConstantPool<ConstantFloat>(IceType_f32); 1027 Writer->writeConstantPool<ConstantFloat>(IceType_f32);
(...skipping 3575 matching lines...) Expand 10 before | Expand all | Expand 10 after
4603 } 4603 }
4604 4604
4605 template <> void ConstantInteger64::emit(GlobalContext *) const { 4605 template <> void ConstantInteger64::emit(GlobalContext *) const {
4606 llvm_unreachable("Not expecting to emit 64-bit integers"); 4606 llvm_unreachable("Not expecting to emit 64-bit integers");
4607 } 4607 }
4608 4608
4609 template <> void ConstantFloat::emit(GlobalContext *Ctx) const { 4609 template <> void ConstantFloat::emit(GlobalContext *Ctx) const {
4610 if (!ALLOW_DUMP) 4610 if (!ALLOW_DUMP)
4611 return; 4611 return;
4612 Ostream &Str = Ctx->getStrEmit(); 4612 Ostream &Str = Ctx->getStrEmit();
4613 Str << ".L$" << IceType_f32 << "$" << getPoolEntryID(); 4613 emitPoolLabel(Str);
4614 } 4614 }
4615 4615
4616 template <> void ConstantDouble::emit(GlobalContext *Ctx) const { 4616 template <> void ConstantDouble::emit(GlobalContext *Ctx) const {
4617 if (!ALLOW_DUMP) 4617 if (!ALLOW_DUMP)
4618 return; 4618 return;
4619 Ostream &Str = Ctx->getStrEmit(); 4619 Ostream &Str = Ctx->getStrEmit();
4620 Str << ".L$" << IceType_f64 << "$" << getPoolEntryID(); 4620 emitPoolLabel(Str);
4621 } 4621 }
4622 4622
4623 void ConstantUndef::emit(GlobalContext *) const { 4623 void ConstantUndef::emit(GlobalContext *) const {
4624 llvm_unreachable("undef value encountered by emitter."); 4624 llvm_unreachable("undef value encountered by emitter.");
4625 } 4625 }
4626 4626
4627 TargetGlobalInitX8632::TargetGlobalInitX8632(GlobalContext *Ctx) 4627 TargetGlobalInitX8632::TargetGlobalInitX8632(GlobalContext *Ctx)
4628 : TargetGlobalInitLowering(Ctx) {} 4628 : TargetGlobalInitLowering(Ctx) {}
4629 4629
4630 void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) { 4630 void TargetGlobalInitX8632::lower(const VariableDeclaration &Var) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4717 } else if (IsConstant || IsExternal) 4717 } else if (IsConstant || IsExternal)
4718 Str << "\t.zero\t" << Size << "\n"; 4718 Str << "\t.zero\t" << Size << "\n";
4719 // Size is part of .comm. 4719 // Size is part of .comm.
4720 4720
4721 if (IsConstant || HasNonzeroInitializer || IsExternal) 4721 if (IsConstant || HasNonzeroInitializer || IsExternal)
4722 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; 4722 Str << "\t.size\t" << MangledName << ", " << Size << "\n";
4723 // Size is part of .comm. 4723 // Size is part of .comm.
4724 } 4724 }
4725 4725
4726 } // end of namespace Ice 4726 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceOperand.h ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698