OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 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 TargetLoweringX8632 class, which | 10 // This file declares the TargetLoweringX8632 class, which |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 virtual size_t typeWidthInBytesOnStack(Type Ty) const { | 45 virtual size_t typeWidthInBytesOnStack(Type Ty) const { |
46 // Round up to the next multiple of 4 bytes. In particular, i1, | 46 // Round up to the next multiple of 4 bytes. In particular, i1, |
47 // i8, and i16 are rounded up to 4 bytes. | 47 // i8, and i16 are rounded up to 4 bytes. |
48 return (typeWidthInBytes(Ty) + 3) & ~3; | 48 return (typeWidthInBytes(Ty) + 3) & ~3; |
49 } | 49 } |
50 virtual SizeT getBundleAlignLog2Bytes() const { return 5; } | 50 virtual SizeT getBundleAlignLog2Bytes() const { return 5; } |
51 virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const { | 51 virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const { |
52 static const uint8_t Padding[] = { 0xF4 }; | 52 static const uint8_t Padding[] = { 0xF4 }; |
53 return llvm::ArrayRef<uint8_t>(Padding, 1); | 53 return llvm::ArrayRef<uint8_t>(Padding, 1); |
54 } | 54 } |
55 virtual void emitVariable(const Variable *Var, const Cfg *Func) const; | 55 virtual void emitVariable(const Variable *Var) const; |
56 virtual void lowerArguments(); | 56 virtual void lowerArguments(); |
57 virtual void addProlog(CfgNode *Node); | 57 virtual void addProlog(CfgNode *Node); |
58 virtual void addEpilog(CfgNode *Node); | 58 virtual void addEpilog(CfgNode *Node); |
59 virtual void emitConstants() const; | 59 virtual void emitConstants() const; |
60 SizeT makeNextLabelNumber() { return NextLabelNumber++; } | 60 SizeT makeNextLabelNumber() { return NextLabelNumber++; } |
61 // Ensure that a 64-bit Variable has been split into 2 32-bit | 61 // Ensure that a 64-bit Variable has been split into 2 32-bit |
62 // Variables, creating them if necessary. This is needed for all | 62 // Variables, creating them if necessary. This is needed for all |
63 // I64 operations, and it is needed for pushing F64 arguments for | 63 // I64 operations, and it is needed for pushing F64 arguments for |
64 // function calls using the 32-bit push instruction (though the | 64 // function calls using the 32-bit push instruction (though the |
65 // latter could be done by directly writing to the stack). | 65 // latter could be done by directly writing to the stack). |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // The following are helpers that insert lowered x86 instructions | 183 // The following are helpers that insert lowered x86 instructions |
184 // with minimal syntactic overhead, so that the lowering code can | 184 // with minimal syntactic overhead, so that the lowering code can |
185 // look as close to assembly as practical. | 185 // look as close to assembly as practical. |
186 void _adc(Variable *Dest, Operand *Src0) { | 186 void _adc(Variable *Dest, Operand *Src0) { |
187 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); | 187 Context.insert(InstX8632Adc::create(Func, Dest, Src0)); |
188 } | 188 } |
189 void _add(Variable *Dest, Operand *Src0) { | 189 void _add(Variable *Dest, Operand *Src0) { |
190 Context.insert(InstX8632Add::create(Func, Dest, Src0)); | 190 Context.insert(InstX8632Add::create(Func, Dest, Src0)); |
191 } | 191 } |
192 void _adjust_stack(int32_t Amount) { | 192 void _adjust_stack(int32_t Amount) { |
193 Context.insert(InstX8632AdjustStack::create(Func, Amount)); | 193 Context.insert(InstX8632AdjustStack::create( |
| 194 Func, Amount, getPhysicalRegister(RegX8632::Reg_esp))); |
194 } | 195 } |
195 void _addps(Variable *Dest, Operand *Src0) { | 196 void _addps(Variable *Dest, Operand *Src0) { |
196 Context.insert(InstX8632Addps::create(Func, Dest, Src0)); | 197 Context.insert(InstX8632Addps::create(Func, Dest, Src0)); |
197 } | 198 } |
198 void _addss(Variable *Dest, Operand *Src0) { | 199 void _addss(Variable *Dest, Operand *Src0) { |
199 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); | 200 Context.insert(InstX8632Addss::create(Func, Dest, Src0)); |
200 } | 201 } |
201 void _and(Variable *Dest, Operand *Src0) { | 202 void _and(Variable *Dest, Operand *Src0) { |
202 Context.insert(InstX8632And::create(Func, Dest, Src0)); | 203 Context.insert(InstX8632And::create(Func, Dest, Src0)); |
203 } | 204 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 }; | 503 }; |
503 | 504 |
504 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; | 505 template <> void ConstantInteger32::emit(GlobalContext *Ctx) const; |
505 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; | 506 template <> void ConstantInteger64::emit(GlobalContext *Ctx) const; |
506 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; | 507 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; |
507 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; | 508 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; |
508 | 509 |
509 } // end of namespace Ice | 510 } // end of namespace Ice |
510 | 511 |
511 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H | 512 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H |
OLD | NEW |