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 and LoweringContext | 10 // This file declares the TargetLowering and LoweringContext |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 RegSet_FramePointer = 1 << 3, | 184 RegSet_FramePointer = 1 << 3, |
185 RegSet_All = ~RegSet_None | 185 RegSet_All = ~RegSet_None |
186 }; | 186 }; |
187 typedef uint32_t RegSetMask; | 187 typedef uint32_t RegSetMask; |
188 | 188 |
189 virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, | 189 virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, |
190 RegSetMask Exclude) const = 0; | 190 RegSetMask Exclude) const = 0; |
191 virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const = 0; | 191 virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const = 0; |
192 void regAlloc(RegAllocKind Kind); | 192 void regAlloc(RegAllocKind Kind); |
193 | 193 |
194 virtual void makeRandomRegisterPermutation( | |
195 llvm::SmallVectorImpl<int32_t> &Permutation, | |
196 const llvm::SmallBitVector &ExcludeRegisters) const = 0; | |
197 | |
194 virtual void emitVariable(const Variable *Var) const = 0; | 198 virtual void emitVariable(const Variable *Var) const = 0; |
195 | 199 |
196 // Performs target-specific argument lowering. | 200 // Performs target-specific argument lowering. |
197 virtual void lowerArguments() = 0; | 201 virtual void lowerArguments() = 0; |
198 | 202 |
199 virtual void addProlog(CfgNode *Node) = 0; | 203 virtual void addProlog(CfgNode *Node) = 0; |
200 virtual void addEpilog(CfgNode *Node) = 0; | 204 virtual void addEpilog(CfgNode *Node) = 0; |
201 | 205 |
202 virtual void emitConstants() const = 0; | 206 virtual void emitConstants() const = 0; |
203 | 207 |
204 virtual ~TargetLowering() {} | 208 virtual ~TargetLowering() {} |
205 | 209 |
206 protected: | 210 protected: |
207 TargetLowering(Cfg *Func) | 211 TargetLowering(Cfg *Func); |
208 : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false), | |
209 CallsReturnsTwice(false), StackAdjustment(0) {} | |
210 virtual void lowerAlloca(const InstAlloca *Inst) = 0; | 212 virtual void lowerAlloca(const InstAlloca *Inst) = 0; |
211 virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; | 213 virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; |
212 virtual void lowerAssign(const InstAssign *Inst) = 0; | 214 virtual void lowerAssign(const InstAssign *Inst) = 0; |
213 virtual void lowerBr(const InstBr *Inst) = 0; | 215 virtual void lowerBr(const InstBr *Inst) = 0; |
214 virtual void lowerCall(const InstCall *Inst) = 0; | 216 virtual void lowerCall(const InstCall *Inst) = 0; |
215 virtual void lowerCast(const InstCast *Inst) = 0; | 217 virtual void lowerCast(const InstCast *Inst) = 0; |
216 virtual void lowerFcmp(const InstFcmp *Inst) = 0; | 218 virtual void lowerFcmp(const InstFcmp *Inst) = 0; |
217 virtual void lowerExtractElement(const InstExtractElement *Inst) = 0; | 219 virtual void lowerExtractElement(const InstExtractElement *Inst) = 0; |
218 virtual void lowerIcmp(const InstIcmp *Inst) = 0; | 220 virtual void lowerIcmp(const InstIcmp *Inst) = 0; |
219 virtual void lowerInsertElement(const InstInsertElement *Inst) = 0; | 221 virtual void lowerInsertElement(const InstInsertElement *Inst) = 0; |
(...skipping 14 matching lines...) Expand all Loading... | |
234 virtual void postLower() {} | 236 virtual void postLower() {} |
235 | 237 |
236 Cfg *Func; | 238 Cfg *Func; |
237 GlobalContext *Ctx; | 239 GlobalContext *Ctx; |
238 bool HasComputedFrame; | 240 bool HasComputedFrame; |
239 bool CallsReturnsTwice; | 241 bool CallsReturnsTwice; |
240 // StackAdjustment keeps track of the current stack offset from its | 242 // StackAdjustment keeps track of the current stack offset from its |
241 // natural location, as arguments are pushed for a function call. | 243 // natural location, as arguments are pushed for a function call. |
242 int32_t StackAdjustment; | 244 int32_t StackAdjustment; |
243 LoweringContext Context; | 245 LoweringContext Context; |
246 const bool RandomizeRegisterAllocation; | |
jvoung (off chromium)
2014/12/17 19:53:34
Maybe keep the bools together.
Jim Stichnoth
2014/12/18 18:52:03
Done.
| |
244 }; | 247 }; |
245 | 248 |
246 // TargetGlobalInitLowering is used for "lowering" global | 249 // TargetGlobalInitLowering is used for "lowering" global |
247 // initializers. It is separated out from TargetLowering because it | 250 // initializers. It is separated out from TargetLowering because it |
248 // does not require a Cfg. | 251 // does not require a Cfg. |
249 class TargetGlobalInitLowering { | 252 class TargetGlobalInitLowering { |
250 TargetGlobalInitLowering(const TargetGlobalInitLowering &) = delete; | 253 TargetGlobalInitLowering(const TargetGlobalInitLowering &) = delete; |
251 TargetGlobalInitLowering &operator=(const TargetGlobalInitLowering &) = | 254 TargetGlobalInitLowering &operator=(const TargetGlobalInitLowering &) = |
252 delete; | 255 delete; |
253 | 256 |
254 public: | 257 public: |
255 static TargetGlobalInitLowering *createLowering(TargetArch Target, | 258 static TargetGlobalInitLowering *createLowering(TargetArch Target, |
256 GlobalContext *Ctx); | 259 GlobalContext *Ctx); |
257 virtual ~TargetGlobalInitLowering(); | 260 virtual ~TargetGlobalInitLowering(); |
258 | 261 |
259 virtual void lower(const VariableDeclaration &Var) = 0; | 262 virtual void lower(const VariableDeclaration &Var) = 0; |
260 | 263 |
261 protected: | 264 protected: |
262 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 265 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
263 GlobalContext *Ctx; | 266 GlobalContext *Ctx; |
264 }; | 267 }; |
265 | 268 |
266 } // end of namespace Ice | 269 } // end of namespace Ice |
267 | 270 |
268 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 271 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |