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

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 1129263005: Convert Constant->emit() definitions to allow multiple targets to define them. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: report fatal Created 5 years, 7 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/IceTargetLoweringX8632.h ('k') | no next file » | 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 4632 matching lines...) Expand 10 before | Expand all | Expand 10 after
4643 if (!First) 4643 if (!First)
4644 Str << " "; 4644 Str << " ";
4645 First = false; 4645 First = false;
4646 Str << getRegName(Register, IceType_i32); 4646 Str << getRegName(Register, IceType_i32);
4647 } 4647 }
4648 Str << "}\n"; 4648 Str << "}\n";
4649 } 4649 }
4650 } 4650 }
4651 } 4651 }
4652 4652
4653 template <> 4653 void TargetX8632::emit(const ConstantInteger32 *C) const {
4654 void ConstantInteger32::emitWithoutDollar(GlobalContext *Ctx) const {
4655 if (!ALLOW_DUMP) 4654 if (!ALLOW_DUMP)
4656 return; 4655 return;
4657 Ostream &Str = Ctx->getStrEmit(); 4656 Ostream &Str = Ctx->getStrEmit();
4658 Str << (int32_t)getValue(); 4657 Str << getConstantPrefix() << C->getValue();
4659 } 4658 }
4660 4659
4661 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const { 4660 void TargetX8632::emit(const ConstantInteger64 *) const {
4661 llvm::report_fatal_error("Not expecting to emit 64-bit integers");
4662 }
4663
4664 void TargetX8632::emit(const ConstantFloat *C) const {
4662 if (!ALLOW_DUMP) 4665 if (!ALLOW_DUMP)
4663 return; 4666 return;
4664 Ostream &Str = Ctx->getStrEmit(); 4667 Ostream &Str = Ctx->getStrEmit();
4665 Str << "$"; 4668 C->emitPoolLabel(Str);
4666 emitWithoutDollar(Ctx);
4667 } 4669 }
4668 4670
4669 template <> void ConstantInteger64::emitWithoutDollar(GlobalContext *) const { 4671 void TargetX8632::emit(const ConstantDouble *C) const {
4670 llvm_unreachable("Not expecting to emitWithoutDollar 64-bit integers");
4671 }
4672
4673 template <> void ConstantInteger64::emit(GlobalContext *) const {
4674 llvm_unreachable("Not expecting to emit 64-bit integers");
4675 }
4676
4677 template <> void ConstantFloat::emitWithoutDollar(GlobalContext *) const {
4678 llvm_unreachable("Not expecting to emitWithoutDollar floats");
4679 }
4680
4681 template <> void ConstantFloat::emit(GlobalContext *Ctx) const {
4682 if (!ALLOW_DUMP) 4672 if (!ALLOW_DUMP)
4683 return; 4673 return;
4684 Ostream &Str = Ctx->getStrEmit(); 4674 Ostream &Str = Ctx->getStrEmit();
4685 emitPoolLabel(Str); 4675 C->emitPoolLabel(Str);
4686 } 4676 }
4687 4677
4688 template <> void ConstantDouble::emitWithoutDollar(GlobalContext *) const { 4678 void TargetX8632::emit(const ConstantUndef *) const {
4689 llvm_unreachable("Not expecting to emitWithoutDollar doubles"); 4679 llvm::report_fatal_error("undef value encountered by emitter.");
4690 }
4691
4692 template <> void ConstantDouble::emit(GlobalContext *Ctx) const {
4693 if (!ALLOW_DUMP)
4694 return;
4695 Ostream &Str = Ctx->getStrEmit();
4696 emitPoolLabel(Str);
4697 }
4698
4699 void ConstantUndef::emitWithoutDollar(GlobalContext *) const {
4700 llvm_unreachable("Not expecting to emitWithoutDollar undef");
4701 }
4702
4703 void ConstantUndef::emit(GlobalContext *) const {
4704 llvm_unreachable("undef value encountered by emitter.");
4705 } 4680 }
4706 4681
4707 TargetDataX8632::TargetDataX8632(GlobalContext *Ctx) 4682 TargetDataX8632::TargetDataX8632(GlobalContext *Ctx)
4708 : TargetDataLowering(Ctx) {} 4683 : TargetDataLowering(Ctx) {}
4709 4684
4710 void TargetDataX8632::lowerGlobal(const VariableDeclaration &Var) const { 4685 void TargetDataX8632::lowerGlobal(const VariableDeclaration &Var) const {
4711 // If external and not initialized, this must be a cross test. 4686 // If external and not initialized, this must be a cross test.
4712 // Don't generate a declaration for such cases. 4687 // Don't generate a declaration for such cases.
4713 bool IsExternal = Var.isExternal() || Ctx->getFlags().getDisableInternal(); 4688 bool IsExternal = Var.isExternal() || Ctx->getFlags().getDisableInternal();
4714 if (IsExternal && !Var.hasInitializer()) 4689 if (IsExternal && !Var.hasInitializer())
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4874 case FT_Asm: 4849 case FT_Asm:
4875 case FT_Iasm: { 4850 case FT_Iasm: {
4876 OstreamLocker L(Ctx); 4851 OstreamLocker L(Ctx);
4877 emitConstantPool<PoolTypeConverter<float>>(Ctx); 4852 emitConstantPool<PoolTypeConverter<float>>(Ctx);
4878 emitConstantPool<PoolTypeConverter<double>>(Ctx); 4853 emitConstantPool<PoolTypeConverter<double>>(Ctx);
4879 } break; 4854 } break;
4880 } 4855 }
4881 } 4856 }
4882 4857
4883 } // end of namespace Ice 4858 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698