OLD | NEW |
1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===// |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 ARM32InstructionSet InstructionSet = ARM32InstructionSet::Begin; | 48 ARM32InstructionSet InstructionSet = ARM32InstructionSet::Begin; |
49 }; | 49 }; |
50 | 50 |
51 // The target lowering logic for ARM32. | 51 // The target lowering logic for ARM32. |
52 class TargetARM32 : public TargetLowering { | 52 class TargetARM32 : public TargetLowering { |
53 TargetARM32() = delete; | 53 TargetARM32() = delete; |
54 TargetARM32(const TargetARM32 &) = delete; | 54 TargetARM32(const TargetARM32 &) = delete; |
55 TargetARM32 &operator=(const TargetARM32 &) = delete; | 55 TargetARM32 &operator=(const TargetARM32 &) = delete; |
56 | 56 |
57 public: | 57 public: |
58 static void staticInit(); | 58 static void staticInit(const ClFlags &Flags); |
59 // TODO(jvoung): return a unique_ptr. | 59 // TODO(jvoung): return a unique_ptr. |
60 static TargetARM32 *create(Cfg *Func) { return new TargetARM32(Func); } | 60 static TargetARM32 *create(Cfg *Func) { return new TargetARM32(Func); } |
61 | 61 |
62 void initNodeForLowering(CfgNode *Node) override { | 62 void initNodeForLowering(CfgNode *Node) override { |
63 Computations.forgetProducers(); | 63 Computations.forgetProducers(); |
64 Computations.recordProducers(Node); | 64 Computations.recordProducers(Node); |
65 Computations.dump(Func); | 65 Computations.dump(Func); |
66 } | 66 } |
67 | 67 |
68 void translateOm1() override; | 68 void translateOm1() override; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 return Ty == IceType_i64; | 113 return Ty == IceType_i64; |
114 } | 114 } |
115 | 115 |
116 // TODO(ascull): what size is best for ARM? | 116 // TODO(ascull): what size is best for ARM? |
117 SizeT getMinJumpTableSize() const override { return 3; } | 117 SizeT getMinJumpTableSize() const override { return 3; } |
118 void emitJumpTable(const Cfg *Func, | 118 void emitJumpTable(const Cfg *Func, |
119 const InstJumpTable *JumpTable) const override; | 119 const InstJumpTable *JumpTable) const override; |
120 | 120 |
121 void emitVariable(const Variable *Var) const override; | 121 void emitVariable(const Variable *Var) const override; |
122 | 122 |
123 const char *getConstantPrefix() const final { return "#"; } | |
124 void emit(const ConstantUndef *C) const final; | 123 void emit(const ConstantUndef *C) const final; |
125 void emit(const ConstantInteger32 *C) const final; | 124 void emit(const ConstantInteger32 *C) const final; |
126 void emit(const ConstantInteger64 *C) const final; | 125 void emit(const ConstantInteger64 *C) const final; |
127 void emit(const ConstantFloat *C) const final; | 126 void emit(const ConstantFloat *C) const final; |
128 void emit(const ConstantDouble *C) const final; | 127 void emit(const ConstantDouble *C) const final; |
| 128 void emit(const ConstantRelocatable *C) const final; |
129 | 129 |
130 void lowerArguments() override; | 130 void lowerArguments() override; |
131 void addProlog(CfgNode *Node) override; | 131 void addProlog(CfgNode *Node) override; |
132 void addEpilog(CfgNode *Node) override; | 132 void addEpilog(CfgNode *Node) override; |
133 | 133 |
134 Operand *loOperand(Operand *Operand); | 134 Operand *loOperand(Operand *Operand); |
135 Operand *hiOperand(Operand *Operand); | 135 Operand *hiOperand(Operand *Operand); |
136 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, | 136 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, |
137 size_t BasicFrameOffset, size_t *InArgsSizeBytes); | 137 size_t BasicFrameOffset, size_t *InArgsSizeBytes); |
138 | 138 |
139 bool hasCPUFeature(TargetARM32Features::ARM32InstructionSet I) const { | 139 bool hasCPUFeature(TargetARM32Features::ARM32InstructionSet I) const { |
140 return CPUFeatures.hasFeature(I); | 140 return CPUFeatures.hasFeature(I); |
141 } | 141 } |
142 | 142 |
143 enum OperandLegalization { | 143 enum OperandLegalization { |
144 Legal_Reg = 1 << 0, /// physical register, not stack location | 144 Legal_Reg = 1 << 0, /// physical register, not stack location |
145 Legal_Flex = 1 << 1, /// A flexible operand2, which can hold rotated small | 145 Legal_Flex = 1 << 1, /// A flexible operand2, which can hold rotated small |
146 /// immediates, shifted registers, or modified fp imm. | 146 /// immediates, shifted registers, or modified fp imm. |
147 Legal_Mem = 1 << 2, /// includes [r0, r1 lsl #2] as well as [sp, #12] | 147 Legal_Mem = 1 << 2, /// includes [r0, r1 lsl #2] as well as [sp, #12] |
148 Legal_Rematerializable = 1 << 3, | 148 Legal_Rematerializable = 1 << 3, |
149 Legal_All = ~Legal_Rematerializable, | 149 Legal_Default = ~Legal_Rematerializable, |
150 }; | 150 }; |
151 | 151 |
152 using LegalMask = uint32_t; | 152 using LegalMask = uint32_t; |
153 Operand *legalizeUndef(Operand *From, int32_t RegNum = Variable::NoRegister); | 153 Operand *legalizeUndef(Operand *From, int32_t RegNum = Variable::NoRegister); |
154 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All, | 154 Operand *legalize(Operand *From, LegalMask Allowed = Legal_Default, |
155 int32_t RegNum = Variable::NoRegister); | 155 int32_t RegNum = Variable::NoRegister); |
156 Variable *legalizeToReg(Operand *From, int32_t RegNum = Variable::NoRegister); | 156 Variable *legalizeToReg(Operand *From, int32_t RegNum = Variable::NoRegister); |
157 | 157 |
158 OperandARM32ShAmtImm *shAmtImm(uint32_t ShAmtImm) const { | 158 OperandARM32ShAmtImm *shAmtImm(uint32_t ShAmtImm) const { |
159 assert(ShAmtImm < 32); | 159 assert(ShAmtImm < 32); |
160 return OperandARM32ShAmtImm::create( | 160 return OperandARM32ShAmtImm::create( |
161 Func, | 161 Func, |
162 llvm::cast<ConstantInteger32>(Ctx->getConstantInt32(ShAmtImm & 0x1F))); | 162 llvm::cast<ConstantInteger32>(Ctx->getConstantInt32(ShAmtImm & 0x1F))); |
163 } | 163 } |
164 | 164 |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1193 |
1194 private: | 1194 private: |
1195 ~TargetHeaderARM32() = default; | 1195 ~TargetHeaderARM32() = default; |
1196 | 1196 |
1197 TargetARM32Features CPUFeatures; | 1197 TargetARM32Features CPUFeatures; |
1198 }; | 1198 }; |
1199 | 1199 |
1200 } // end of namespace Ice | 1200 } // end of namespace Ice |
1201 | 1201 |
1202 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H | 1202 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H |
OLD | NEW |