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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 InstList::iterator Next; | 84 InstList::iterator Next; |
85 /// Begin is a copy of Insts.begin(), used if iterators are moved backward. | 85 /// Begin is a copy of Insts.begin(), used if iterators are moved backward. |
86 InstList::iterator Begin; | 86 InstList::iterator Begin; |
87 /// End is a copy of Insts.end(), used if Next needs to be advanced. | 87 /// End is a copy of Insts.end(), used if Next needs to be advanced. |
88 InstList::iterator End; | 88 InstList::iterator End; |
89 | 89 |
90 void skipDeleted(InstList::iterator &I) const; | 90 void skipDeleted(InstList::iterator &I) const; |
91 void advanceForward(InstList::iterator &I) const; | 91 void advanceForward(InstList::iterator &I) const; |
92 }; | 92 }; |
93 | 93 |
94 /// A helper class to advance the LoweringContext at each loop iteration. | |
95 class PostIncrLoweringContext { | |
96 PostIncrLoweringContext() = delete; | |
97 PostIncrLoweringContext(const PostIncrLoweringContext &) = delete; | |
98 PostIncrLoweringContext &operator=(const PostIncrLoweringContext &) = delete; | |
99 | |
100 public: | |
101 explicit PostIncrLoweringContext(LoweringContext &Context) | |
102 : Context(Context) {} | |
103 ~PostIncrLoweringContext() { | |
104 Context.advanceCur(); | |
105 Context.advanceNext(); | |
106 } | |
107 | |
108 private: | |
109 LoweringContext &Context; | |
110 }; | |
111 | |
94 class TargetLowering { | 112 class TargetLowering { |
95 TargetLowering() = delete; | 113 TargetLowering() = delete; |
96 TargetLowering(const TargetLowering &) = delete; | 114 TargetLowering(const TargetLowering &) = delete; |
97 TargetLowering &operator=(const TargetLowering &) = delete; | 115 TargetLowering &operator=(const TargetLowering &) = delete; |
98 | 116 |
99 public: | 117 public: |
100 // TODO(jvoung): return a unique_ptr like the other factory functions. | 118 // TODO(jvoung): return a unique_ptr like the other factory functions. |
101 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); | 119 static TargetLowering *createLowering(TargetArch Target, Cfg *Func); |
102 static std::unique_ptr<Assembler> createAssembler(TargetArch Target, | 120 static std::unique_ptr<Assembler> createAssembler(TargetArch Target, |
103 Cfg *Func); | 121 Cfg *Func); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 /// register. This is generally used to get very direct access to | 175 /// register. This is generally used to get very direct access to |
158 /// the register such as in the prolog or epilog or for marking | 176 /// the register such as in the prolog or epilog or for marking |
159 /// scratch registers as killed by a call. If a Type is not | 177 /// scratch registers as killed by a call. If a Type is not |
160 /// provided, a target-specific default type is used. | 178 /// provided, a target-specific default type is used. |
161 virtual Variable *getPhysicalRegister(SizeT RegNum, | 179 virtual Variable *getPhysicalRegister(SizeT RegNum, |
162 Type Ty = IceType_void) = 0; | 180 Type Ty = IceType_void) = 0; |
163 /// Returns a printable name for the register. | 181 /// Returns a printable name for the register. |
164 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; | 182 virtual IceString getRegName(SizeT RegNum, Type Ty) const = 0; |
165 | 183 |
166 virtual bool hasFramePointer() const { return false; } | 184 virtual bool hasFramePointer() const { return false; } |
167 virtual SizeT getFrameOrStackReg() const = 0; | 185 virtual SizeT getFrameOrStackReg() const = 0; |
Jim Stichnoth
2015/07/24 22:08:29
What do you think about changing this to something
jvoung (off chromium)
2015/07/27 17:02:58
I'm not totally sure that would simplify things.
Jim Stichnoth
2015/07/30 13:34:52
I see, OK.
| |
168 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; | 186 virtual size_t typeWidthInBytesOnStack(Type Ty) const = 0; |
169 | 187 |
170 bool hasComputedFrame() const { return HasComputedFrame; } | 188 bool hasComputedFrame() const { return HasComputedFrame; } |
171 /// Returns true if this function calls a function that has the | 189 /// Returns true if this function calls a function that has the |
172 /// "returns twice" attribute. | 190 /// "returns twice" attribute. |
173 bool callsReturnsTwice() const { return CallsReturnsTwice; } | 191 bool callsReturnsTwice() const { return CallsReturnsTwice; } |
174 void setCallsReturnsTwice(bool RetTwice) { CallsReturnsTwice = RetTwice; } | 192 void setCallsReturnsTwice(bool RetTwice) { CallsReturnsTwice = RetTwice; } |
175 int32_t getStackAdjustment() const { return StackAdjustment; } | 193 int32_t getStackAdjustment() const { return StackAdjustment; } |
176 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } | 194 void updateStackAdjustment(int32_t Offset) { StackAdjustment += Offset; } |
177 void resetStackAdjustment() { StackAdjustment = 0; } | 195 void resetStackAdjustment() { StackAdjustment = 0; } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 virtual void lower() {} | 444 virtual void lower() {} |
427 | 445 |
428 protected: | 446 protected: |
429 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 447 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
430 GlobalContext *Ctx; | 448 GlobalContext *Ctx; |
431 }; | 449 }; |
432 | 450 |
433 } // end of namespace Ice | 451 } // end of namespace Ice |
434 | 452 |
435 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 453 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |