OLD | NEW |
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // | 113 // |
114 // * Stack arguments of vector type are aligned to start at the next | 114 // * Stack arguments of vector type are aligned to start at the next |
115 // highest multiple of 16 bytes. Other stack arguments are aligned to | 115 // highest multiple of 16 bytes. Other stack arguments are aligned to |
116 // 4 bytes. | 116 // 4 bytes. |
117 // | 117 // |
118 // This intends to match the section "IA-32 Function Calling | 118 // This intends to match the section "IA-32 Function Calling |
119 // Convention" of the document "OS X ABI Function Call Guide" by | 119 // Convention" of the document "OS X ABI Function Call Guide" by |
120 // Apple. | 120 // Apple. |
121 NeedsStackAlignment = true; | 121 NeedsStackAlignment = true; |
122 | 122 |
123 typedef std::vector<Operand *> OperandList; | 123 using OperandList = std::vector<Operand *>; |
124 OperandList XmmArgs; | 124 OperandList XmmArgs; |
125 OperandList StackArgs, StackArgLocations; | 125 OperandList StackArgs, StackArgLocations; |
126 uint32_t ParameterAreaSizeBytes = 0; | 126 uint32_t ParameterAreaSizeBytes = 0; |
127 | 127 |
128 // Classify each argument operand according to the location where the | 128 // Classify each argument operand according to the location where the |
129 // argument is passed. | 129 // argument is passed. |
130 for (SizeT i = 0, NumArgs = Instr->getNumArgs(); i < NumArgs; ++i) { | 130 for (SizeT i = 0, NumArgs = Instr->getNumArgs(); i < NumArgs; ++i) { |
131 Operand *Arg = Instr->getArg(i); | 131 Operand *Arg = Instr->getArg(i); |
132 Type Ty = Arg->getType(); | 132 Type Ty = Arg->getType(); |
133 // The PNaCl ABI requires the width of arguments to be at least 32 bits. | 133 // The PNaCl ABI requires the width of arguments to be at least 32 bits. |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 Str << "\n"; | 646 Str << "\n"; |
647 } | 647 } |
648 | 648 |
649 TargetDataX8632::TargetDataX8632(GlobalContext *Ctx) | 649 TargetDataX8632::TargetDataX8632(GlobalContext *Ctx) |
650 : TargetDataLowering(Ctx) {} | 650 : TargetDataLowering(Ctx) {} |
651 | 651 |
652 namespace { | 652 namespace { |
653 template <typename T> struct PoolTypeConverter {}; | 653 template <typename T> struct PoolTypeConverter {}; |
654 | 654 |
655 template <> struct PoolTypeConverter<float> { | 655 template <> struct PoolTypeConverter<float> { |
656 typedef uint32_t PrimitiveIntType; | 656 using PrimitiveIntType = uint32_t; |
657 typedef ConstantFloat IceType; | 657 using IceType = ConstantFloat; |
658 static const Type Ty = IceType_f32; | 658 static const Type Ty = IceType_f32; |
659 static const char *TypeName; | 659 static const char *TypeName; |
660 static const char *AsmTag; | 660 static const char *AsmTag; |
661 static const char *PrintfString; | 661 static const char *PrintfString; |
662 }; | 662 }; |
663 const char *PoolTypeConverter<float>::TypeName = "float"; | 663 const char *PoolTypeConverter<float>::TypeName = "float"; |
664 const char *PoolTypeConverter<float>::AsmTag = ".long"; | 664 const char *PoolTypeConverter<float>::AsmTag = ".long"; |
665 const char *PoolTypeConverter<float>::PrintfString = "0x%x"; | 665 const char *PoolTypeConverter<float>::PrintfString = "0x%x"; |
666 | 666 |
667 template <> struct PoolTypeConverter<double> { | 667 template <> struct PoolTypeConverter<double> { |
668 typedef uint64_t PrimitiveIntType; | 668 using PrimitiveIntType = uint64_t; |
669 typedef ConstantDouble IceType; | 669 using IceType = ConstantDouble; |
670 static const Type Ty = IceType_f64; | 670 static const Type Ty = IceType_f64; |
671 static const char *TypeName; | 671 static const char *TypeName; |
672 static const char *AsmTag; | 672 static const char *AsmTag; |
673 static const char *PrintfString; | 673 static const char *PrintfString; |
674 }; | 674 }; |
675 const char *PoolTypeConverter<double>::TypeName = "double"; | 675 const char *PoolTypeConverter<double>::TypeName = "double"; |
676 const char *PoolTypeConverter<double>::AsmTag = ".quad"; | 676 const char *PoolTypeConverter<double>::AsmTag = ".quad"; |
677 const char *PoolTypeConverter<double>::PrintfString = "0x%llx"; | 677 const char *PoolTypeConverter<double>::PrintfString = "0x%llx"; |
678 | 678 |
679 // Add converter for int type constant pooling | 679 // Add converter for int type constant pooling |
680 template <> struct PoolTypeConverter<uint32_t> { | 680 template <> struct PoolTypeConverter<uint32_t> { |
681 typedef uint32_t PrimitiveIntType; | 681 using PrimitiveIntType = uint32_t; |
682 typedef ConstantInteger32 IceType; | 682 using IceType = ConstantInteger32; |
683 static const Type Ty = IceType_i32; | 683 static const Type Ty = IceType_i32; |
684 static const char *TypeName; | 684 static const char *TypeName; |
685 static const char *AsmTag; | 685 static const char *AsmTag; |
686 static const char *PrintfString; | 686 static const char *PrintfString; |
687 }; | 687 }; |
688 const char *PoolTypeConverter<uint32_t>::TypeName = "i32"; | 688 const char *PoolTypeConverter<uint32_t>::TypeName = "i32"; |
689 const char *PoolTypeConverter<uint32_t>::AsmTag = ".long"; | 689 const char *PoolTypeConverter<uint32_t>::AsmTag = ".long"; |
690 const char *PoolTypeConverter<uint32_t>::PrintfString = "0x%x"; | 690 const char *PoolTypeConverter<uint32_t>::PrintfString = "0x%x"; |
691 | 691 |
692 // Add converter for int type constant pooling | 692 // Add converter for int type constant pooling |
693 template <> struct PoolTypeConverter<uint16_t> { | 693 template <> struct PoolTypeConverter<uint16_t> { |
694 typedef uint32_t PrimitiveIntType; | 694 using PrimitiveIntType = uint32_t; |
695 typedef ConstantInteger32 IceType; | 695 using IceType = ConstantInteger32; |
696 static const Type Ty = IceType_i16; | 696 static const Type Ty = IceType_i16; |
697 static const char *TypeName; | 697 static const char *TypeName; |
698 static const char *AsmTag; | 698 static const char *AsmTag; |
699 static const char *PrintfString; | 699 static const char *PrintfString; |
700 }; | 700 }; |
701 const char *PoolTypeConverter<uint16_t>::TypeName = "i16"; | 701 const char *PoolTypeConverter<uint16_t>::TypeName = "i16"; |
702 const char *PoolTypeConverter<uint16_t>::AsmTag = ".short"; | 702 const char *PoolTypeConverter<uint16_t>::AsmTag = ".short"; |
703 const char *PoolTypeConverter<uint16_t>::PrintfString = "0x%x"; | 703 const char *PoolTypeConverter<uint16_t>::PrintfString = "0x%x"; |
704 | 704 |
705 // Add converter for int type constant pooling | 705 // Add converter for int type constant pooling |
706 template <> struct PoolTypeConverter<uint8_t> { | 706 template <> struct PoolTypeConverter<uint8_t> { |
707 typedef uint32_t PrimitiveIntType; | 707 using PrimitiveIntType = uint32_t; |
708 typedef ConstantInteger32 IceType; | 708 using IceType = ConstantInteger32; |
709 static const Type Ty = IceType_i8; | 709 static const Type Ty = IceType_i8; |
710 static const char *TypeName; | 710 static const char *TypeName; |
711 static const char *AsmTag; | 711 static const char *AsmTag; |
712 static const char *PrintfString; | 712 static const char *PrintfString; |
713 }; | 713 }; |
714 const char *PoolTypeConverter<uint8_t>::TypeName = "i8"; | 714 const char *PoolTypeConverter<uint8_t>::TypeName = "i8"; |
715 const char *PoolTypeConverter<uint8_t>::AsmTag = ".byte"; | 715 const char *PoolTypeConverter<uint8_t>::AsmTag = ".byte"; |
716 const char *PoolTypeConverter<uint8_t>::PrintfString = "0x%x"; | 716 const char *PoolTypeConverter<uint8_t>::PrintfString = "0x%x"; |
717 } // end of anonymous namespace | 717 } // end of anonymous namespace |
718 | 718 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 // entries in case the high-level table has extra entries. | 948 // entries in case the high-level table has extra entries. |
949 #define X(tag, sizeLog2, align, elts, elty, str) \ | 949 #define X(tag, sizeLog2, align, elts, elty, str) \ |
950 static_assert(_table1_##tag == _table2_##tag, \ | 950 static_assert(_table1_##tag == _table2_##tag, \ |
951 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); | 951 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
952 ICETYPE_TABLE | 952 ICETYPE_TABLE |
953 #undef X | 953 #undef X |
954 } // end of namespace dummy3 | 954 } // end of namespace dummy3 |
955 } // end of anonymous namespace | 955 } // end of anonymous namespace |
956 | 956 |
957 } // end of namespace Ice | 957 } // end of namespace Ice |
OLD | NEW |