| 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 /// \file | 10 /// \file |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 virtual void translateO1() { | 146 virtual void translateO1() { |
| 147 Func->setError("Target doesn't specify O1 lowering steps."); | 147 Func->setError("Target doesn't specify O1 lowering steps."); |
| 148 } | 148 } |
| 149 virtual void translateO2() { | 149 virtual void translateO2() { |
| 150 Func->setError("Target doesn't specify O2 lowering steps."); | 150 Func->setError("Target doesn't specify O2 lowering steps."); |
| 151 } | 151 } |
| 152 | 152 |
| 153 /// Tries to do address mode optimization on a single instruction. | 153 /// Tries to do address mode optimization on a single instruction. |
| 154 void doAddressOpt(); | 154 void doAddressOpt(); |
| 155 /// Randomly insert NOPs. | 155 /// Randomly insert NOPs. |
| 156 void doNopInsertion(); | 156 void doNopInsertion(RandomNumberGenerator &RNG); |
| 157 /// Lowers a single non-Phi instruction. | 157 /// Lowers a single non-Phi instruction. |
| 158 void lower(); | 158 void lower(); |
| 159 /// Inserts and lowers a single high-level instruction at a specific insertion | 159 /// Inserts and lowers a single high-level instruction at a specific insertion |
| 160 /// point. | 160 /// point. |
| 161 void lowerInst(CfgNode *Node, InstList::iterator Next, InstHighLevel *Instr); | 161 void lowerInst(CfgNode *Node, InstList::iterator Next, InstHighLevel *Instr); |
| 162 /// Does preliminary lowering of the set of Phi instructions in the | 162 /// Does preliminary lowering of the set of Phi instructions in the |
| 163 /// current node. The main intention is to do what's needed to keep | 163 /// current node. The main intention is to do what's needed to keep |
| 164 /// the unlowered Phi instructions consistent with the lowered | 164 /// the unlowered Phi instructions consistent with the lowered |
| 165 /// non-Phi instructions, e.g. to lower 64-bit operands on a 32-bit | 165 /// non-Phi instructions, e.g. to lower 64-bit operands on a 32-bit |
| 166 /// target. | 166 /// target. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 RegSet_FramePointer = 1 << 3, | 206 RegSet_FramePointer = 1 << 3, |
| 207 RegSet_All = ~RegSet_None | 207 RegSet_All = ~RegSet_None |
| 208 }; | 208 }; |
| 209 typedef uint32_t RegSetMask; | 209 typedef uint32_t RegSetMask; |
| 210 | 210 |
| 211 virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, | 211 virtual llvm::SmallBitVector getRegisterSet(RegSetMask Include, |
| 212 RegSetMask Exclude) const = 0; | 212 RegSetMask Exclude) const = 0; |
| 213 virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const = 0; | 213 virtual const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const = 0; |
| 214 void regAlloc(RegAllocKind Kind); | 214 void regAlloc(RegAllocKind Kind); |
| 215 | 215 |
| 216 virtual void makeRandomRegisterPermutation( | 216 virtual void |
| 217 llvm::SmallVectorImpl<int32_t> &Permutation, | 217 makeRandomRegisterPermutation(llvm::SmallVectorImpl<int32_t> &Permutation, |
| 218 const llvm::SmallBitVector &ExcludeRegisters) const = 0; | 218 const llvm::SmallBitVector &ExcludeRegisters, |
| 219 uint64_t Salt) const = 0; |
| 219 | 220 |
| 220 /// Save/restore any mutable state for the situation where code | 221 /// Save/restore any mutable state for the situation where code |
| 221 /// emission needs multiple passes, such as sandboxing or relaxation. | 222 /// emission needs multiple passes, such as sandboxing or relaxation. |
| 222 /// Subclasses may provide their own implementation, but should be | 223 /// Subclasses may provide their own implementation, but should be |
| 223 /// sure to also call the parent class's methods. | 224 /// sure to also call the parent class's methods. |
| 224 virtual void snapshotEmitState() { | 225 virtual void snapshotEmitState() { |
| 225 SnapshotStackAdjustment = StackAdjustment; | 226 SnapshotStackAdjustment = StackAdjustment; |
| 226 } | 227 } |
| 227 virtual void rollbackEmitState() { | 228 virtual void rollbackEmitState() { |
| 228 StackAdjustment = SnapshotStackAdjustment; | 229 StackAdjustment = SnapshotStackAdjustment; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 virtual void lowerPhi(const InstPhi *Inst) = 0; | 273 virtual void lowerPhi(const InstPhi *Inst) = 0; |
| 273 virtual void lowerRet(const InstRet *Inst) = 0; | 274 virtual void lowerRet(const InstRet *Inst) = 0; |
| 274 virtual void lowerSelect(const InstSelect *Inst) = 0; | 275 virtual void lowerSelect(const InstSelect *Inst) = 0; |
| 275 virtual void lowerStore(const InstStore *Inst) = 0; | 276 virtual void lowerStore(const InstStore *Inst) = 0; |
| 276 virtual void lowerSwitch(const InstSwitch *Inst) = 0; | 277 virtual void lowerSwitch(const InstSwitch *Inst) = 0; |
| 277 virtual void lowerUnreachable(const InstUnreachable *Inst) = 0; | 278 virtual void lowerUnreachable(const InstUnreachable *Inst) = 0; |
| 278 virtual void lowerOther(const Inst *Instr); | 279 virtual void lowerOther(const Inst *Instr); |
| 279 | 280 |
| 280 virtual void doAddressOptLoad() {} | 281 virtual void doAddressOptLoad() {} |
| 281 virtual void doAddressOptStore() {} | 282 virtual void doAddressOptStore() {} |
| 282 virtual void randomlyInsertNop(float Probability) = 0; | 283 virtual void randomlyInsertNop(float Probability, |
| 284 RandomNumberGenerator &RNG) = 0; |
| 283 /// This gives the target an opportunity to post-process the lowered | 285 /// This gives the target an opportunity to post-process the lowered |
| 284 /// expansion before returning. | 286 /// expansion before returning. |
| 285 virtual void postLower() {} | 287 virtual void postLower() {} |
| 286 | 288 |
| 287 /// Find two-address non-SSA instructions and set the DestNonKillable flag | 289 /// Find two-address non-SSA instructions and set the DestNonKillable flag |
| 288 /// to keep liveness analysis consistent. | 290 /// to keep liveness analysis consistent. |
| 289 void inferTwoAddress(); | 291 void inferTwoAddress(); |
| 290 | 292 |
| 291 /// Make a pass over the Cfg to determine which variables need stack slots | 293 /// Make a pass over the Cfg to determine which variables need stack slots |
| 292 /// and place them in a sorted list (SortedSpilledVariables). Among those, | 294 /// and place them in a sorted list (SortedSpilledVariables). Among those, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 virtual void lower() {} | 454 virtual void lower() {} |
| 453 | 455 |
| 454 protected: | 456 protected: |
| 455 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 457 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
| 456 GlobalContext *Ctx; | 458 GlobalContext *Ctx; |
| 457 }; | 459 }; |
| 458 | 460 |
| 459 } // end of namespace Ice | 461 } // end of namespace Ice |
| 460 | 462 |
| 461 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 463 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
| OLD | NEW |