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 // This file declares the TargetLoweringARM32 class, which implements the | 10 // This file declares the TargetLoweringARM32 class, which implements the |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 bool hasFramePointer() const override { return UsesFramePointer; } | 46 bool hasFramePointer() const override { return UsesFramePointer; } |
47 SizeT getFrameOrStackReg() const override { | 47 SizeT getFrameOrStackReg() const override { |
48 return UsesFramePointer ? RegARM32::Reg_fp : RegARM32::Reg_sp; | 48 return UsesFramePointer ? RegARM32::Reg_fp : RegARM32::Reg_sp; |
49 } | 49 } |
50 size_t typeWidthInBytesOnStack(Type Ty) const override { | 50 size_t typeWidthInBytesOnStack(Type Ty) const override { |
51 // Round up to the next multiple of 4 bytes. In particular, i1, | 51 // Round up to the next multiple of 4 bytes. In particular, i1, |
52 // i8, and i16 are rounded up to 4 bytes. | 52 // i8, and i16 are rounded up to 4 bytes. |
53 return (typeWidthInBytes(Ty) + 3) & ~3; | 53 return (typeWidthInBytes(Ty) + 3) & ~3; |
54 } | 54 } |
| 55 size_t minStackSlotSizeLog2() const final { return 2; } |
| 56 size_t maxStackSlotSizeLog2() const final { return 4; } |
| 57 |
55 void emitVariable(const Variable *Var) const override; | 58 void emitVariable(const Variable *Var) const override; |
56 | 59 |
57 const char *getConstantPrefix() const final { return "#"; } | 60 const char *getConstantPrefix() const final { return "#"; } |
58 void emit(const ConstantUndef *C) const final; | 61 void emit(const ConstantUndef *C) const final; |
59 void emit(const ConstantInteger32 *C) const final; | 62 void emit(const ConstantInteger32 *C) const final; |
60 void emit(const ConstantInteger64 *C) const final; | 63 void emit(const ConstantInteger64 *C) const final; |
61 void emit(const ConstantFloat *C) const final; | 64 void emit(const ConstantFloat *C) const final; |
62 void emit(const ConstantDouble *C) const final; | 65 void emit(const ConstantDouble *C) const final; |
63 | 66 |
64 void lowerArguments() override; | 67 void lowerArguments() override; |
65 void addProlog(CfgNode *Node) override; | 68 void addProlog(CfgNode *Node) override; |
66 void addEpilog(CfgNode *Node) override; | 69 void addEpilog(CfgNode *Node) override; |
67 | 70 |
68 // Ensure that a 64-bit Variable has been split into 2 32-bit | 71 // Ensure that a 64-bit Variable has been split into 2 32-bit |
69 // Variables, creating them if necessary. This is needed for all | 72 // Variables, creating them if necessary. This is needed for all |
70 // I64 operations. | 73 // I64 operations. |
71 void split64(Variable *Var); | 74 void split64(Variable *Var); |
72 Operand *loOperand(Operand *Operand); | 75 Operand *loOperand(Operand *Operand); |
73 Operand *hiOperand(Operand *Operand); | 76 Operand *hiOperand(Operand *Operand); |
| 77 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, |
| 78 size_t BasicFrameOffset, size_t &InArgsSizeBytes); |
74 | 79 |
75 protected: | 80 protected: |
76 explicit TargetARM32(Cfg *Func); | 81 explicit TargetARM32(Cfg *Func); |
77 | 82 |
78 void postLower() override; | 83 void postLower() override; |
79 | 84 |
80 void lowerAlloca(const InstAlloca *Inst) override; | 85 void lowerAlloca(const InstAlloca *Inst) override; |
81 void lowerArithmetic(const InstArithmetic *Inst) override; | 86 void lowerArithmetic(const InstArithmetic *Inst) override; |
82 void lowerAssign(const InstAssign *Inst) override; | 87 void lowerAssign(const InstAssign *Inst) override; |
83 void lowerBr(const InstBr *Inst) override; | 88 void lowerBr(const InstBr *Inst) override; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 Context.insert(InstARM32Mul::create(Func, Dest, Src0, Src1, Pred)); | 217 Context.insert(InstARM32Mul::create(Func, Dest, Src0, Src1, Pred)); |
213 } | 218 } |
214 void _mvn(Variable *Dest, Operand *Src0, | 219 void _mvn(Variable *Dest, Operand *Src0, |
215 CondARM32::Cond Pred = CondARM32::AL) { | 220 CondARM32::Cond Pred = CondARM32::AL) { |
216 Context.insert(InstARM32Mvn::create(Func, Dest, Src0, Pred)); | 221 Context.insert(InstARM32Mvn::create(Func, Dest, Src0, Pred)); |
217 } | 222 } |
218 void _orr(Variable *Dest, Variable *Src0, Operand *Src1, | 223 void _orr(Variable *Dest, Variable *Src0, Operand *Src1, |
219 CondARM32::Cond Pred = CondARM32::AL) { | 224 CondARM32::Cond Pred = CondARM32::AL) { |
220 Context.insert(InstARM32Orr::create(Func, Dest, Src0, Src1, Pred)); | 225 Context.insert(InstARM32Orr::create(Func, Dest, Src0, Src1, Pred)); |
221 } | 226 } |
| 227 void _push(const VarList &Sources) { |
| 228 Context.insert(InstARM32Push::create(Func, Sources)); |
| 229 } |
| 230 void _pop(const VarList &Dests) { |
| 231 Variable *First = Dests[0]; |
| 232 Context.insert(InstARM32Pop::create(Func, Dests)); |
| 233 // Mark other dests as modified. |
| 234 for (size_t I = 1; I < Dests.size(); ++I) { |
| 235 Context.insert(InstFakeDef::create(Func, Dests[I], First)); |
| 236 } |
| 237 } |
222 void _sbc(Variable *Dest, Variable *Src0, Operand *Src1, | 238 void _sbc(Variable *Dest, Variable *Src0, Operand *Src1, |
223 CondARM32::Cond Pred = CondARM32::AL) { | 239 CondARM32::Cond Pred = CondARM32::AL) { |
224 Context.insert(InstARM32Sbc::create(Func, Dest, Src0, Src1, Pred)); | 240 Context.insert(InstARM32Sbc::create(Func, Dest, Src0, Src1, Pred)); |
225 } | 241 } |
226 void _sbcs(Variable *Dest, Variable *Src0, Operand *Src1, | 242 void _sbcs(Variable *Dest, Variable *Src0, Operand *Src1, |
227 CondARM32::Cond Pred = CondARM32::AL) { | 243 CondARM32::Cond Pred = CondARM32::AL) { |
228 const bool SetFlags = true; | 244 const bool SetFlags = true; |
229 Context.insert( | 245 Context.insert( |
230 InstARM32Sbc::create(Func, Dest, Src0, Src1, Pred, SetFlags)); | 246 InstARM32Sbc::create(Func, Dest, Src0, Src1, Pred, SetFlags)); |
231 } | 247 } |
(...skipping 14 matching lines...) Expand all Loading... |
246 Variable *Src1, CondARM32::Cond Pred = CondARM32::AL) { | 262 Variable *Src1, CondARM32::Cond Pred = CondARM32::AL) { |
247 Context.insert( | 263 Context.insert( |
248 InstARM32Umull::create(Func, DestLo, DestHi, Src0, Src1, Pred)); | 264 InstARM32Umull::create(Func, DestLo, DestHi, Src0, Src1, Pred)); |
249 // Model the modification to the second dest as a fake def. | 265 // Model the modification to the second dest as a fake def. |
250 // Note that the def is not predicated. | 266 // Note that the def is not predicated. |
251 Context.insert(InstFakeDef::create(Func, DestHi, DestLo)); | 267 Context.insert(InstFakeDef::create(Func, DestHi, DestLo)); |
252 } | 268 } |
253 | 269 |
254 bool UsesFramePointer; | 270 bool UsesFramePointer; |
255 bool NeedsStackAlignment; | 271 bool NeedsStackAlignment; |
| 272 bool MaybeLeafFunc; |
| 273 size_t SpillAreaSizeBytes; |
256 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 274 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; |
257 llvm::SmallBitVector ScratchRegs; | 275 llvm::SmallBitVector ScratchRegs; |
258 llvm::SmallBitVector RegsUsed; | 276 llvm::SmallBitVector RegsUsed; |
259 VarList PhysicalRegisters[IceType_NUM]; | 277 VarList PhysicalRegisters[IceType_NUM]; |
260 static IceString RegNames[]; | 278 static IceString RegNames[]; |
261 | 279 |
262 private: | 280 private: |
263 ~TargetARM32() override {} | 281 ~TargetARM32() override {} |
264 }; | 282 }; |
265 | 283 |
(...skipping 15 matching lines...) Expand all Loading... |
281 | 299 |
282 private: | 300 private: |
283 void lowerGlobal(const VariableDeclaration &Var) const; | 301 void lowerGlobal(const VariableDeclaration &Var) const; |
284 ~TargetDataARM32() override {} | 302 ~TargetDataARM32() override {} |
285 template <typename T> static void emitConstantPool(GlobalContext *Ctx); | 303 template <typename T> static void emitConstantPool(GlobalContext *Ctx); |
286 }; | 304 }; |
287 | 305 |
288 } // end of namespace Ice | 306 } // end of namespace Ice |
289 | 307 |
290 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H | 308 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H |
OLD | NEW |