| 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; |
| 220 virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst) = 0; | 222 virtual void lowerIntrinsicCall(const InstIntrinsicCall *Inst) = 0; |
| 221 virtual void lowerLoad(const InstLoad *Inst) = 0; | 223 virtual void lowerLoad(const InstLoad *Inst) = 0; |
| 222 virtual void lowerPhi(const InstPhi *Inst) = 0; | 224 virtual void lowerPhi(const InstPhi *Inst) = 0; |
| 223 virtual void lowerRet(const InstRet *Inst) = 0; | 225 virtual void lowerRet(const InstRet *Inst) = 0; |
| 224 virtual void lowerSelect(const InstSelect *Inst) = 0; | 226 virtual void lowerSelect(const InstSelect *Inst) = 0; |
| 225 virtual void lowerStore(const InstStore *Inst) = 0; | 227 virtual void lowerStore(const InstStore *Inst) = 0; |
| 226 virtual void lowerSwitch(const InstSwitch *Inst) = 0; | 228 virtual void lowerSwitch(const InstSwitch *Inst) = 0; |
| 227 virtual void lowerUnreachable(const InstUnreachable *Inst) = 0; | 229 virtual void lowerUnreachable(const InstUnreachable *Inst) = 0; |
| 228 | 230 |
| 229 virtual void doAddressOptLoad() {} | 231 virtual void doAddressOptLoad() {} |
| 230 virtual void doAddressOptStore() {} | 232 virtual void doAddressOptStore() {} |
| 231 virtual void randomlyInsertNop(float Probability) = 0; | 233 virtual void randomlyInsertNop(float Probability) = 0; |
| 232 // This gives the target an opportunity to post-process the lowered | 234 // This gives the target an opportunity to post-process the lowered |
| 233 // expansion before returning. | 235 // expansion before returning. |
| 234 virtual void postLower() {} | 236 virtual void postLower() {} |
| 235 | 237 |
| 236 Cfg *Func; | 238 Cfg *Func; |
| 237 GlobalContext *Ctx; | 239 GlobalContext *Ctx; |
| 240 const bool RandomizeRegisterAllocation; |
| 238 bool HasComputedFrame; | 241 bool HasComputedFrame; |
| 239 bool CallsReturnsTwice; | 242 bool CallsReturnsTwice; |
| 240 // StackAdjustment keeps track of the current stack offset from its | 243 // StackAdjustment keeps track of the current stack offset from its |
| 241 // natural location, as arguments are pushed for a function call. | 244 // natural location, as arguments are pushed for a function call. |
| 242 int32_t StackAdjustment; | 245 int32_t StackAdjustment; |
| 243 LoweringContext Context; | 246 LoweringContext Context; |
| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 |