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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 class Assembler; | 29 class Assembler; |
30 | 30 |
31 // LoweringContext makes it easy to iterate through non-deleted | 31 // LoweringContext makes it easy to iterate through non-deleted |
32 // instructions in a node, and insert new (lowered) instructions at | 32 // instructions in a node, and insert new (lowered) instructions at |
33 // the current point. Along with the instruction list container and | 33 // the current point. Along with the instruction list container and |
34 // associated iterators, it holds the current node, which is needed | 34 // associated iterators, it holds the current node, which is needed |
35 // when inserting new instructions in order to track whether variables | 35 // when inserting new instructions in order to track whether variables |
36 // are used as single-block or multi-block. | 36 // are used as single-block or multi-block. |
37 class LoweringContext { | 37 class LoweringContext { |
| 38 LoweringContext(const LoweringContext &) = delete; |
| 39 LoweringContext &operator=(const LoweringContext &) = delete; |
| 40 |
38 public: | 41 public: |
39 LoweringContext() : Node(NULL) {} | 42 LoweringContext() : Node(NULL) {} |
40 ~LoweringContext() {} | 43 ~LoweringContext() {} |
41 void init(CfgNode *Node); | 44 void init(CfgNode *Node); |
42 Inst *getNextInst() const { | 45 Inst *getNextInst() const { |
43 if (Next == End) | 46 if (Next == End) |
44 return NULL; | 47 return NULL; |
45 return *Next; | 48 return *Next; |
46 } | 49 } |
47 Inst *getNextInst(InstList::iterator &Iter) const { | 50 Inst *getNextInst(InstList::iterator &Iter) const { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // instructions come between the two points. | 82 // instructions come between the two points. |
80 InstList::iterator Next; | 83 InstList::iterator Next; |
81 // Begin is a copy of Insts.begin(), used if iterators are moved backward. | 84 // Begin is a copy of Insts.begin(), used if iterators are moved backward. |
82 InstList::iterator Begin; | 85 InstList::iterator Begin; |
83 // End is a copy of Insts.end(), used if Next needs to be advanced. | 86 // End is a copy of Insts.end(), used if Next needs to be advanced. |
84 InstList::iterator End; | 87 InstList::iterator End; |
85 | 88 |
86 void skipDeleted(InstList::iterator &I) const; | 89 void skipDeleted(InstList::iterator &I) const; |
87 void advanceForward(InstList::iterator &I) const; | 90 void advanceForward(InstList::iterator &I) const; |
88 void advanceBackward(InstList::iterator &I) const; | 91 void advanceBackward(InstList::iterator &I) const; |
89 LoweringContext(const LoweringContext &) = delete; | |
90 LoweringContext &operator=(const LoweringContext &) = delete; | |
91 }; | 92 }; |
92 | 93 |
93 class TargetLowering { | 94 class TargetLowering { |
| 95 TargetLowering(const TargetLowering &) = delete; |
| 96 TargetLowering &operator=(const TargetLowering &) = delete; |
| 97 |
94 public: | 98 public: |
95 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); | 99 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); |
96 static Assembler *createAssembler(TargetArch Target, Cfg *Func); | 100 static Assembler *createAssembler(TargetArch Target, Cfg *Func); |
97 void translate() { | 101 void translate() { |
98 switch (Ctx->getOptLevel()) { | 102 switch (Ctx->getOptLevel()) { |
99 case Opt_m1: | 103 case Opt_m1: |
100 translateOm1(); | 104 translateOm1(); |
101 break; | 105 break; |
102 case Opt_0: | 106 case Opt_0: |
103 translateO0(); | 107 translateO0(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 virtual void postLower() {} | 230 virtual void postLower() {} |
227 | 231 |
228 Cfg *Func; | 232 Cfg *Func; |
229 GlobalContext *Ctx; | 233 GlobalContext *Ctx; |
230 bool HasComputedFrame; | 234 bool HasComputedFrame; |
231 bool CallsReturnsTwice; | 235 bool CallsReturnsTwice; |
232 // StackAdjustment keeps track of the current stack offset from its | 236 // StackAdjustment keeps track of the current stack offset from its |
233 // natural location, as arguments are pushed for a function call. | 237 // natural location, as arguments are pushed for a function call. |
234 int32_t StackAdjustment; | 238 int32_t StackAdjustment; |
235 LoweringContext Context; | 239 LoweringContext Context; |
236 | |
237 private: | |
238 TargetLowering(const TargetLowering &) = delete; | |
239 TargetLowering &operator=(const TargetLowering &) = delete; | |
240 }; | 240 }; |
241 | 241 |
242 // TargetGlobalInitLowering is used for "lowering" global | 242 // TargetGlobalInitLowering is used for "lowering" global |
243 // initializers. It is separated out from TargetLowering because it | 243 // initializers. It is separated out from TargetLowering because it |
244 // does not require a Cfg. | 244 // does not require a Cfg. |
245 class TargetGlobalInitLowering { | 245 class TargetGlobalInitLowering { |
| 246 TargetGlobalInitLowering(const TargetGlobalInitLowering &) = delete; |
| 247 TargetGlobalInitLowering &operator=(const TargetGlobalInitLowering &) = |
| 248 delete; |
| 249 |
246 public: | 250 public: |
247 static TargetGlobalInitLowering *createLowering(TargetArch Target, | 251 static TargetGlobalInitLowering *createLowering(TargetArch Target, |
248 GlobalContext *Ctx); | 252 GlobalContext *Ctx); |
249 virtual ~TargetGlobalInitLowering(); | 253 virtual ~TargetGlobalInitLowering(); |
250 | 254 |
251 virtual void lower(const VariableDeclaration &Var) = 0; | 255 virtual void lower(const VariableDeclaration &Var) = 0; |
252 | 256 |
253 protected: | 257 protected: |
254 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 258 TargetGlobalInitLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
255 GlobalContext *Ctx; | 259 GlobalContext *Ctx; |
256 | |
257 private: | |
258 TargetGlobalInitLowering(const TargetGlobalInitLowering &) = delete; | |
259 TargetGlobalInitLowering &operator=(const TargetGlobalInitLowering &) = | |
260 delete; | |
261 }; | 260 }; |
262 | 261 |
263 } // end of namespace Ice | 262 } // end of namespace Ice |
264 | 263 |
265 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 264 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |