OLD | NEW |
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// |
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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 if (Align > 1) { | 816 if (Align > 1) { |
817 assert(llvm::isPowerOf2_32(Align)); | 817 assert(llvm::isPowerOf2_32(Align)); |
818 // Use the .p2align directive, since the .align N directive can either | 818 // Use the .p2align directive, since the .align N directive can either |
819 // interpret N as bytes, or power of 2 bytes, depending on the target. | 819 // interpret N as bytes, or power of 2 bytes, depending on the target. |
820 Str << "\t.p2align\t" << llvm::Log2_32(Align) << "\n"; | 820 Str << "\t.p2align\t" << llvm::Log2_32(Align) << "\n"; |
821 } | 821 } |
822 | 822 |
823 Str << Name << ":\n"; | 823 Str << Name << ":\n"; |
824 | 824 |
825 if (HasNonzeroInitializer) { | 825 if (HasNonzeroInitializer) { |
826 for (const std::unique_ptr<VariableDeclaration::Initializer> &Init : | 826 for (const auto *Init : Var.getInitializers()) { |
827 Var.getInitializers()) { | |
828 switch (Init->getKind()) { | 827 switch (Init->getKind()) { |
829 case VariableDeclaration::Initializer::DataInitializerKind: { | 828 case VariableDeclaration::Initializer::DataInitializerKind: { |
830 const auto &Data = | 829 const auto &Data = |
831 llvm::cast<VariableDeclaration::DataInitializer>(Init.get()) | 830 llvm::cast<VariableDeclaration::DataInitializer>(Init) |
832 ->getContents(); | 831 ->getContents(); |
833 for (SizeT i = 0; i < Init->getNumBytes(); ++i) { | 832 for (SizeT i = 0; i < Init->getNumBytes(); ++i) { |
834 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 833 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
835 } | 834 } |
836 break; | 835 break; |
837 } | 836 } |
838 case VariableDeclaration::Initializer::ZeroInitializerKind: | 837 case VariableDeclaration::Initializer::ZeroInitializerKind: |
839 Str << "\t.zero\t" << Init->getNumBytes() << "\n"; | 838 Str << "\t.zero\t" << Init->getNumBytes() << "\n"; |
840 break; | 839 break; |
841 case VariableDeclaration::Initializer::RelocInitializerKind: { | 840 case VariableDeclaration::Initializer::RelocInitializerKind: { |
842 const auto *Reloc = | 841 const auto *Reloc = |
843 llvm::cast<VariableDeclaration::RelocInitializer>(Init.get()); | 842 llvm::cast<VariableDeclaration::RelocInitializer>(Init); |
844 Str << "\t" << getEmit32Directive() << "\t"; | 843 Str << "\t" << getEmit32Directive() << "\t"; |
845 Str << Reloc->getDeclaration()->getName(); | 844 Str << Reloc->getDeclaration()->getName(); |
846 if (Reloc->hasFixup()) { | 845 if (Reloc->hasFixup()) { |
847 // TODO(jpp): this is ARM32 specific. | 846 // TODO(jpp): this is ARM32 specific. |
848 Str << "(GOTOFF)"; | 847 Str << "(GOTOFF)"; |
849 } | 848 } |
850 if (RelocOffsetT Offset = Reloc->getOffset()) { | 849 if (RelocOffsetT Offset = Reloc->getOffset()) { |
851 if (Offset >= 0 || (Offset == INT32_MIN)) | 850 if (Offset >= 0 || (Offset == INT32_MIN)) |
852 Str << " + " << Offset; | 851 Str << " + " << Offset; |
853 else | 852 else |
(...skipping 25 matching lines...) Expand all Loading... |
879 case Target_##X: \ | 878 case Target_##X: \ |
880 return ::X::createTargetHeaderLowering(Ctx); | 879 return ::X::createTargetHeaderLowering(Ctx); |
881 #include "llvm/Config/SZTargets.def" | 880 #include "llvm/Config/SZTargets.def" |
882 #undef SUBZERO_TARGET | 881 #undef SUBZERO_TARGET |
883 } | 882 } |
884 } | 883 } |
885 | 884 |
886 TargetHeaderLowering::~TargetHeaderLowering() = default; | 885 TargetHeaderLowering::~TargetHeaderLowering() = default; |
887 | 886 |
888 } // end of namespace Ice | 887 } // end of namespace Ice |
OLD | NEW |