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 |
11 /// \brief Declares the TargetLowering, LoweringContext, and TargetDataLowering | 11 /// \brief Declares the TargetLowering, LoweringContext, and TargetDataLowering |
12 /// classes. | 12 /// classes. |
13 /// | 13 /// |
14 /// TargetLowering is an abstract class used to drive the translation/lowering | 14 /// TargetLowering is an abstract class used to drive the translation/lowering |
15 /// process. LoweringContext maintains a context for lowering each instruction, | 15 /// process. LoweringContext maintains a context for lowering each instruction, |
16 /// offering conveniences such as iterating over non-deleted instructions. | 16 /// offering conveniences such as iterating over non-deleted instructions. |
17 /// TargetDataLowering is an abstract class used to drive the lowering/emission | 17 /// TargetDataLowering is an abstract class used to drive the lowering/emission |
18 /// of global initializers, external global declarations, and internal constant | 18 /// of global initializers, external global declarations, and internal constant |
19 /// pools. | 19 /// pools. |
20 /// | 20 /// |
21 //===----------------------------------------------------------------------===// | 21 //===----------------------------------------------------------------------===// |
22 | 22 |
23 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H | 23 #ifndef SUBZERO_SRC_ICETARGETLOWERING_H |
24 #define SUBZERO_SRC_ICETARGETLOWERING_H | 24 #define SUBZERO_SRC_ICETARGETLOWERING_H |
25 | 25 |
26 #include "IceDefs.h" | |
27 #include "IceBitVector.h" | 26 #include "IceBitVector.h" |
28 #include "IceCfgNode.h" | 27 #include "IceCfgNode.h" |
| 28 #include "IceDefs.h" |
29 #include "IceInst.h" // for the names of the Inst subtypes | 29 #include "IceInst.h" // for the names of the Inst subtypes |
30 #include "IceOperand.h" | 30 #include "IceOperand.h" |
| 31 #include "IceRegAlloc.h" |
31 #include "IceTypes.h" | 32 #include "IceTypes.h" |
32 | 33 |
33 #include <utility> | 34 #include <utility> |
34 | 35 |
35 namespace Ice { | 36 namespace Ice { |
36 | 37 |
37 // UnimplementedError is defined as a macro so that we can get actual line | 38 // UnimplementedError is defined as a macro so that we can get actual line |
38 // numbers. | 39 // numbers. |
39 #define UnimplementedError(Flags) \ | 40 #define UnimplementedError(Flags) \ |
40 do { \ | 41 do { \ |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 virtual const SmallBitVector & | 284 virtual const SmallBitVector & |
284 getRegistersForVariable(const Variable *Var) const = 0; | 285 getRegistersForVariable(const Variable *Var) const = 0; |
285 /// Get the set of *all* physical registers available for the specified | 286 /// Get the set of *all* physical registers available for the specified |
286 /// Variable's register class, *not* applying register restrictions from the | 287 /// Variable's register class, *not* applying register restrictions from the |
287 /// command line. | 288 /// command line. |
288 virtual const SmallBitVector & | 289 virtual const SmallBitVector & |
289 getAllRegistersForVariable(const Variable *Var) const = 0; | 290 getAllRegistersForVariable(const Variable *Var) const = 0; |
290 virtual const SmallBitVector &getAliasesForRegister(RegNumT) const = 0; | 291 virtual const SmallBitVector &getAliasesForRegister(RegNumT) const = 0; |
291 | 292 |
292 void regAlloc(RegAllocKind Kind); | 293 void regAlloc(RegAllocKind Kind); |
| 294 void postRegallocSplitting(const SmallBitVector &RegMask); |
293 | 295 |
294 virtual void | 296 virtual void |
295 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, | 297 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, |
296 const SmallBitVector &ExcludeRegisters, | 298 const SmallBitVector &ExcludeRegisters, |
297 uint64_t Salt) const = 0; | 299 uint64_t Salt) const = 0; |
298 | 300 |
299 /// Get the minimum number of clusters required for a jump table to be | 301 /// Get the minimum number of clusters required for a jump table to be |
300 /// considered. | 302 /// considered. |
301 virtual SizeT getMinJumpTableSize() const = 0; | 303 virtual SizeT getMinJumpTableSize() const = 0; |
302 virtual void emitJumpTable(const Cfg *Func, | 304 virtual void emitJumpTable(const Cfg *Func, |
(...skipping 11 matching lines...) Expand all Loading... |
314 virtual void emit(const ConstantUndef *C) const = 0; | 316 virtual void emit(const ConstantUndef *C) const = 0; |
315 virtual void emit(const ConstantRelocatable *CR) const = 0; | 317 virtual void emit(const ConstantRelocatable *CR) const = 0; |
316 | 318 |
317 /// Performs target-specific argument lowering. | 319 /// Performs target-specific argument lowering. |
318 virtual void lowerArguments() = 0; | 320 virtual void lowerArguments() = 0; |
319 | 321 |
320 virtual void initNodeForLowering(CfgNode *) {} | 322 virtual void initNodeForLowering(CfgNode *) {} |
321 virtual void addProlog(CfgNode *Node) = 0; | 323 virtual void addProlog(CfgNode *Node) = 0; |
322 virtual void addEpilog(CfgNode *Node) = 0; | 324 virtual void addEpilog(CfgNode *Node) = 0; |
323 | 325 |
| 326 virtual Inst *createLoweredMove(Variable *Dest, Variable *SrcVar) { |
| 327 (void)Dest; |
| 328 (void)SrcVar; |
| 329 llvm_unreachable("unimplemented createLoweredMove"); |
| 330 } |
| 331 |
324 virtual ~TargetLowering() = default; | 332 virtual ~TargetLowering() = default; |
325 | 333 |
326 private: | 334 private: |
327 // This control variable is used by AutoBundle (RAII-style bundle | 335 // This control variable is used by AutoBundle (RAII-style bundle |
328 // locking/unlocking) to prevent nested bundles. | 336 // locking/unlocking) to prevent nested bundles. |
329 bool AutoBundling = false; | 337 bool AutoBundling = false; |
330 | 338 |
331 /// This indicates whether we are in the genTargetHelperCalls phase, and | 339 /// This indicates whether we are in the genTargetHelperCalls phase, and |
332 /// therefore can do things like scalarization. | 340 /// therefore can do things like scalarization. |
333 bool GeneratingTargetHelpers = false; | 341 bool GeneratingTargetHelpers = false; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 virtual void lower() {} | 629 virtual void lower() {} |
622 | 630 |
623 protected: | 631 protected: |
624 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 632 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
625 GlobalContext *Ctx; | 633 GlobalContext *Ctx; |
626 }; | 634 }; |
627 | 635 |
628 } // end of namespace Ice | 636 } // end of namespace Ice |
629 | 637 |
630 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 638 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |