OLD | NEW |
1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- 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 TargetLowering, LoweringContext, and | 10 // This file declares the TargetLowering, LoweringContext, and |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 class TargetLowering { | 92 class TargetLowering { |
93 TargetLowering() = delete; | 93 TargetLowering() = delete; |
94 TargetLowering(const TargetLowering &) = delete; | 94 TargetLowering(const TargetLowering &) = delete; |
95 TargetLowering &operator=(const TargetLowering &) = delete; | 95 TargetLowering &operator=(const TargetLowering &) = delete; |
96 | 96 |
97 public: | 97 public: |
98 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); | 98 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); |
99 static std::unique_ptr<Assembler> createAssembler(TargetArch Target, | 99 static std::unique_ptr<Assembler> createAssembler(TargetArch Target, |
100 Cfg *Func); | 100 Cfg *Func); |
101 void translate() { | 101 void translate() { |
102 switch (Ctx->getOptLevel()) { | 102 switch (Ctx->getFlags().getOptLevel()) { |
103 case Opt_m1: | 103 case Opt_m1: |
104 translateOm1(); | 104 translateOm1(); |
105 break; | 105 break; |
106 case Opt_0: | 106 case Opt_0: |
107 translateO0(); | 107 translateO0(); |
108 break; | 108 break; |
109 case Opt_1: | 109 case Opt_1: |
110 translateO1(); | 110 translateO1(); |
111 break; | 111 break; |
112 case Opt_2: | 112 case Opt_2: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // provided, a target-specific default type is used. | 157 // provided, a target-specific default type is used. |
158 virtual Variable *getPhysicalRegister(SizeT RegNum, | 158 virtual Variable *getPhysicalRegister(SizeT RegNum, |
159 Type Ty = IceType_void) = 0; | 159 Type Ty = IceType_void) = 0; |
160 // Returns a printable name for the register. | 160 // Returns a printable name for the register. |
161 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; | 161 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; |
162 | 162 |
163 virtual bool hasFramePointer() const { return false; } | 163 virtual bool hasFramePointer() const { return false; } |
164 virtual SizeT getFrameOrStackReg() const = 0; | 164 virtual SizeT getFrameOrStackReg() const = 0; |
165 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; | 165 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; |
166 bool hasComputedFrame() const { return HasComputedFrame; } | 166 bool hasComputedFrame() const { return HasComputedFrame; } |
167 bool shouldDoNopInsertion() const; | |
168 // Returns true if this function calls a function that has the | 167 // Returns true if this function calls a function that has the |
169 // "returns twice" attribute. | 168 // "returns twice" attribute. |
170 bool callsReturnsTwice() const { return CallsReturnsTwice; } | 169 bool callsReturnsTwice() const { return CallsReturnsTwice; } |
171 void setCallsReturnsTwice(bool RetTwice) { CallsReturnsTwice = RetTwice; } | 170 void setCallsReturnsTwice(bool RetTwice) { CallsReturnsTwice = RetTwice; } |
172 int32_t getStackAdjustment() const { return StackAdjustment; } | 171 int32_t getStackAdjustment() const { return StackAdjustment; } |
173 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } | 172 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } |
174 void resetStackAdjustment() { StackAdjustment = 0; } | 173 void resetStackAdjustment() { StackAdjustment = 0; } |
175 LoweringContext &getContext() { return Context; } | 174 LoweringContext &getContext() { return Context; } |
176 | 175 |
177 enum RegSet { | 176 enum RegSet { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 236 |
238 virtual void doAddressOptLoad() {} | 237 virtual void doAddressOptLoad() {} |
239 virtual void doAddressOptStore() {} | 238 virtual void doAddressOptStore() {} |
240 virtual void randomlyInsertNop(float Probability) = 0; | 239 virtual void randomlyInsertNop(float Probability) = 0; |
241 // This gives the target an opportunity to post-process the lowered | 240 // This gives the target an opportunity to post-process the lowered |
242 // expansion before returning. | 241 // expansion before returning. |
243 virtual void postLower() {} | 242 virtual void postLower() {} |
244 | 243 |
245 Cfg *Func; | 244 Cfg *Func; |
246 GlobalContext *Ctx; | 245 GlobalContext *Ctx; |
247 const bool RandomizeRegisterAllocation; | |
248 bool HasComputedFrame; | 246 bool HasComputedFrame; |
249 bool CallsReturnsTwice; | 247 bool CallsReturnsTwice; |
250 // StackAdjustment keeps track of the current stack offset from its | 248 // StackAdjustment keeps track of the current stack offset from its |
251 // natural location, as arguments are pushed for a function call. | 249 // natural location, as arguments are pushed for a function call. |
252 int32_t StackAdjustment; | 250 int32_t StackAdjustment; |
253 LoweringContext Context; | 251 LoweringContext Context; |
254 | 252 |
255 // Runtime helper function names | 253 // Runtime helper function names |
256 const static constexpr char *H_bitcast_16xi1_i16 = "__Sz_bitcast_16xi1_i16"; | 254 const static constexpr char *H_bitcast_16xi1_i16 = "__Sz_bitcast_16xi1_i16"; |
257 const static constexpr char *H_bitcast_8xi1_i8 = "__Sz_bitcast_8xi1_i8"; | 255 const static constexpr char *H_bitcast_8xi1_i8 = "__Sz_bitcast_8xi1_i8"; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 virtual void lowerConstants() const = 0; | 305 virtual void lowerConstants() const = 0; |
308 | 306 |
309 protected: | 307 protected: |
310 explicit TargetDataLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 308 explicit TargetDataLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
311 GlobalContext *Ctx; | 309 GlobalContext *Ctx; |
312 }; | 310 }; |
313 | 311 |
314 } // end of namespace Ice | 312 } // end of namespace Ice |
315 | 313 |
316 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 314 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |