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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 /// | 145 /// |
146 /// namespace X8632 { | 146 /// namespace X8632 { |
147 /// void createTargetLowering(Cfg *Func); | 147 /// void createTargetLowering(Cfg *Func); |
148 /// } | 148 /// } |
149 class TargetLowering { | 149 class TargetLowering { |
150 TargetLowering() = delete; | 150 TargetLowering() = delete; |
151 TargetLowering(const TargetLowering &) = delete; | 151 TargetLowering(const TargetLowering &) = delete; |
152 TargetLowering &operator=(const TargetLowering &) = delete; | 152 TargetLowering &operator=(const TargetLowering &) = delete; |
153 | 153 |
154 public: | 154 public: |
155 static void staticInit(const ClFlags &Flags); | 155 static void staticInit(GlobalContext *Ctx); |
156 // Each target must define a public static method: | 156 // Each target must define a public static method: |
157 // static void staticInit(const ClFlags &Flags); | 157 // static void staticInit(GlobalContext *Ctx); |
158 | 158 |
159 static std::unique_ptr<TargetLowering> createLowering(TargetArch Target, | 159 static std::unique_ptr<TargetLowering> createLowering(TargetArch Target, |
160 Cfg *Func); | 160 Cfg *Func); |
161 | 161 |
162 virtual std::unique_ptr<Assembler> createAssembler() const = 0; | 162 virtual std::unique_ptr<Assembler> createAssembler() const = 0; |
163 | 163 |
164 void translate() { | 164 void translate() { |
165 switch (Ctx->getFlags().getOptLevel()) { | 165 switch (Ctx->getFlags().getOptLevel()) { |
166 case Opt_m1: | 166 case Opt_m1: |
167 translateOm1(); | 167 translateOm1(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 virtual void lowerArguments() = 0; | 292 virtual void lowerArguments() = 0; |
293 | 293 |
294 virtual void initNodeForLowering(CfgNode *) {} | 294 virtual void initNodeForLowering(CfgNode *) {} |
295 virtual void addProlog(CfgNode *Node) = 0; | 295 virtual void addProlog(CfgNode *Node) = 0; |
296 virtual void addEpilog(CfgNode *Node) = 0; | 296 virtual void addEpilog(CfgNode *Node) = 0; |
297 | 297 |
298 virtual ~TargetLowering() = default; | 298 virtual ~TargetLowering() = default; |
299 | 299 |
300 protected: | 300 protected: |
301 explicit TargetLowering(Cfg *Func); | 301 explicit TargetLowering(Cfg *Func); |
| 302 // Applies command line filters to TypeToRegisterSet array. |
| 303 static void |
| 304 filterTypeToRegisterSet(GlobalContext *Ctx, int32_t NumRegs, |
| 305 llvm::SmallBitVector TypeToRegisterSet[], |
| 306 size_t TypeToRegisterSetSize, |
| 307 std::function<IceString(int32_t)> getRegName); |
302 virtual void lowerAlloca(const InstAlloca *Inst) = 0; | 308 virtual void lowerAlloca(const InstAlloca *Inst) = 0; |
303 virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; | 309 virtual void lowerArithmetic(const InstArithmetic *Inst) = 0; |
304 virtual void lowerAssign(const InstAssign *Inst) = 0; | 310 virtual void lowerAssign(const InstAssign *Inst) = 0; |
305 virtual void lowerBr(const InstBr *Inst) = 0; | 311 virtual void lowerBr(const InstBr *Inst) = 0; |
306 virtual void lowerCall(const InstCall *Inst) = 0; | 312 virtual void lowerCall(const InstCall *Inst) = 0; |
307 virtual void lowerCast(const InstCast *Inst) = 0; | 313 virtual void lowerCast(const InstCast *Inst) = 0; |
308 virtual void lowerFcmp(const InstFcmp *Inst) = 0; | 314 virtual void lowerFcmp(const InstFcmp *Inst) = 0; |
309 virtual void lowerExtractElement(const InstExtractElement *Inst) = 0; | 315 virtual void lowerExtractElement(const InstExtractElement *Inst) = 0; |
310 virtual void lowerIcmp(const InstIcmp *Inst) = 0; | 316 virtual void lowerIcmp(const InstIcmp *Inst) = 0; |
311 virtual void lowerInsertElement(const InstInsertElement *Inst) = 0; | 317 virtual void lowerInsertElement(const InstInsertElement *Inst) = 0; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 virtual void lower() {} | 497 virtual void lower() {} |
492 | 498 |
493 protected: | 499 protected: |
494 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 500 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
495 GlobalContext *Ctx; | 501 GlobalContext *Ctx; |
496 }; | 502 }; |
497 | 503 |
498 } // end of namespace Ice | 504 } // end of namespace Ice |
499 | 505 |
500 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 506 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |