OLD | NEW |
1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===// | 1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 namespace Ice { | 53 namespace Ice { |
54 namespace MIPS32 { | 54 namespace MIPS32 { |
55 | 55 |
56 using llvm::isInt; | 56 using llvm::isInt; |
57 | 57 |
58 namespace { | 58 namespace { |
59 | 59 |
60 // The maximum number of arguments to pass in GPR registers. | 60 // The maximum number of arguments to pass in GPR registers. |
61 constexpr uint32_t MIPS32_MAX_GPR_ARG = 4; | 61 constexpr uint32_t MIPS32_MAX_GPR_ARG = 4; |
62 | 62 |
| 63 IceString getRegClassName(RegClass C) { |
| 64 auto ClassNum = static_cast<RegClassMIPS32>(C); |
| 65 assert(ClassNum < RCMIPS32_NUM); |
| 66 switch (ClassNum) { |
| 67 default: |
| 68 assert(C < RC_Target); |
| 69 return regClassString(C); |
| 70 // Add handling of new register classes below. |
| 71 } |
| 72 } |
| 73 |
63 } // end of anonymous namespace | 74 } // end of anonymous namespace |
64 | 75 |
65 TargetMIPS32::TargetMIPS32(Cfg *Func) : TargetLowering(Func) {} | 76 TargetMIPS32::TargetMIPS32(Cfg *Func) : TargetLowering(Func) {} |
66 | 77 |
67 void TargetMIPS32::staticInit(GlobalContext *Ctx) { | 78 void TargetMIPS32::staticInit(GlobalContext *Ctx) { |
68 (void)Ctx; | 79 (void)Ctx; |
69 llvm::SmallBitVector IntegerRegisters(RegMIPS32::Reg_NUM); | 80 llvm::SmallBitVector IntegerRegisters(RegMIPS32::Reg_NUM); |
70 llvm::SmallBitVector I64PairRegisters(RegMIPS32::Reg_NUM); | 81 llvm::SmallBitVector I64PairRegisters(RegMIPS32::Reg_NUM); |
71 llvm::SmallBitVector Float32Registers(RegMIPS32::Reg_NUM); | 82 llvm::SmallBitVector Float32Registers(RegMIPS32::Reg_NUM); |
72 llvm::SmallBitVector Float64Registers(RegMIPS32::Reg_NUM); | 83 llvm::SmallBitVector Float64Registers(RegMIPS32::Reg_NUM); |
(...skipping 26 matching lines...) Expand all Loading... |
99 TypeToRegisterSet[IceType_f64] = Float64Registers; | 110 TypeToRegisterSet[IceType_f64] = Float64Registers; |
100 TypeToRegisterSet[IceType_v4i1] = VectorRegisters; | 111 TypeToRegisterSet[IceType_v4i1] = VectorRegisters; |
101 TypeToRegisterSet[IceType_v8i1] = VectorRegisters; | 112 TypeToRegisterSet[IceType_v8i1] = VectorRegisters; |
102 TypeToRegisterSet[IceType_v16i1] = VectorRegisters; | 113 TypeToRegisterSet[IceType_v16i1] = VectorRegisters; |
103 TypeToRegisterSet[IceType_v16i8] = VectorRegisters; | 114 TypeToRegisterSet[IceType_v16i8] = VectorRegisters; |
104 TypeToRegisterSet[IceType_v8i16] = VectorRegisters; | 115 TypeToRegisterSet[IceType_v8i16] = VectorRegisters; |
105 TypeToRegisterSet[IceType_v4i32] = VectorRegisters; | 116 TypeToRegisterSet[IceType_v4i32] = VectorRegisters; |
106 TypeToRegisterSet[IceType_v4f32] = VectorRegisters; | 117 TypeToRegisterSet[IceType_v4f32] = VectorRegisters; |
107 | 118 |
108 filterTypeToRegisterSet(Ctx, RegMIPS32::Reg_NUM, TypeToRegisterSet, | 119 filterTypeToRegisterSet(Ctx, RegMIPS32::Reg_NUM, TypeToRegisterSet, |
109 RCMIPS32_NUM, [](int32_t RegNum) -> IceString { | 120 llvm::array_lengthof(TypeToRegisterSet), |
110 return RegMIPS32::getRegName(RegNum); | 121 RegMIPS32::getRegName, getRegClassName); |
111 }); | |
112 } | 122 } |
113 | 123 |
114 void TargetMIPS32::translateO2() { | 124 void TargetMIPS32::translateO2() { |
115 TimerMarker T(TimerStack::TT_O2, Func); | 125 TimerMarker T(TimerStack::TT_O2, Func); |
116 | 126 |
117 // TODO(stichnot): share passes with X86? | 127 // TODO(stichnot): share passes with X86? |
118 // https://code.google.com/p/nativeclient/issues/detail?id=4094 | 128 // https://code.google.com/p/nativeclient/issues/detail?id=4094 |
119 genTargetHelperCalls(); | 129 genTargetHelperCalls(); |
120 | 130 |
121 // Merge Alloca instructions, and lay out the stack. | 131 // Merge Alloca instructions, and lay out the stack. |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 | 1118 |
1109 void TargetHeaderMIPS32::lower() { | 1119 void TargetHeaderMIPS32::lower() { |
1110 OstreamLocker L(Ctx); | 1120 OstreamLocker L(Ctx); |
1111 Ostream &Str = Ctx->getStrEmit(); | 1121 Ostream &Str = Ctx->getStrEmit(); |
1112 Str << "\t.set\t" | 1122 Str << "\t.set\t" |
1113 << "nomicromips\n"; | 1123 << "nomicromips\n"; |
1114 Str << "\t.set\t" | 1124 Str << "\t.set\t" |
1115 << "nomips16\n"; | 1125 << "nomips16\n"; |
1116 } | 1126 } |
1117 | 1127 |
1118 llvm::SmallBitVector TargetMIPS32::TypeToRegisterSet[IceType_NUM]; | 1128 llvm::SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; |
1119 llvm::SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; | 1129 llvm::SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; |
1120 | 1130 |
1121 } // end of namespace MIPS32 | 1131 } // end of namespace MIPS32 |
1122 } // end of namespace Ice | 1132 } // end of namespace Ice |
OLD | NEW |