OLD | NEW |
1 //===- subzero/src/IceTranslator.h - ICE to machine code --------*- C++ -*-===// | 1 //===- subzero/src/IceTranslator.h - ICE to machine code --------*- 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 general driver class for translating ICE to | 10 // This file declares the general driver class for translating ICE to |
(...skipping 18 matching lines...) Expand all Loading... |
29 class GlobalContext; | 29 class GlobalContext; |
30 | 30 |
31 // Base class for translating ICE to machine code. Derived classes convert | 31 // Base class for translating ICE to machine code. Derived classes convert |
32 // other intermediate representations down to ICE, and then call the appropriate | 32 // other intermediate representations down to ICE, and then call the appropriate |
33 // (inherited) methods to convert ICE into machine instructions. | 33 // (inherited) methods to convert ICE into machine instructions. |
34 class Translator { | 34 class Translator { |
35 Translator(const Translator &) = delete; | 35 Translator(const Translator &) = delete; |
36 Translator &operator=(const Translator &) = delete; | 36 Translator &operator=(const Translator &) = delete; |
37 | 37 |
38 public: | 38 public: |
39 typedef std::vector<VariableDeclaration *> VariableDeclarationListType; | |
40 | |
41 Translator(GlobalContext *Ctx, const ClFlags &Flags) | 39 Translator(GlobalContext *Ctx, const ClFlags &Flags) |
42 : Ctx(Ctx), Flags(Flags), ErrorStatus(0) {} | 40 : Ctx(Ctx), Flags(Flags), ErrorStatus(0) {} |
43 | 41 |
44 ~Translator(); | 42 ~Translator(); |
45 bool getErrorStatus() const { return ErrorStatus; } | 43 bool getErrorStatus() const { return ErrorStatus; } |
46 | 44 |
47 GlobalContext *getContext() const { return Ctx; } | 45 GlobalContext *getContext() const { return Ctx; } |
48 | 46 |
49 const ClFlags &getFlags() const { return Flags; } | 47 const ClFlags &getFlags() const { return Flags; } |
50 | 48 |
51 /// Translates the constructed ICE function Fcn to machine code. | 49 /// Translates the constructed ICE function Fcn to machine code. |
52 /// Takes ownership of Fcn. Note: As a side effect, Field Func is | 50 /// Takes ownership of Fcn. Note: As a side effect, Field Func is |
53 /// set to Fcn. | 51 /// set to Fcn. |
54 void translateFcn(Cfg *Fcn); | 52 void translateFcn(Cfg *Fcn); |
55 | 53 |
56 /// Emits the constant pool. | 54 /// Emits the constant pool. |
57 void emitConstants(); | 55 void emitConstants(); |
58 | 56 |
59 /// Lowers the given list of global addresses to target. Generates | 57 /// Lowers the given list of global addresses to target. Generates |
60 /// list of corresponding variable declarations. | 58 /// list of corresponding variable declarations. |
61 void lowerGlobals(const VariableDeclarationListType &VariableDeclarations); | 59 void lowerGlobals(const VariableDeclarationList &VariableDeclarations); |
62 | 60 |
63 /// Creates a name using the given prefix and corresponding index. | 61 /// Creates a name using the given prefix and corresponding index. |
64 std::string createUnnamedName(const IceString &Prefix, SizeT Index); | 62 std::string createUnnamedName(const IceString &Prefix, SizeT Index); |
65 | 63 |
66 /// Reports if there is a (potential) conflict between Name, and using | 64 /// Reports if there is a (potential) conflict between Name, and using |
67 /// Prefix to name unnamed names. Errors are put on Ostream. | 65 /// Prefix to name unnamed names. Errors are put on Ostream. |
68 /// Returns true if there isn't a potential conflict. | 66 /// Returns true if there isn't a potential conflict. |
69 bool checkIfUnnamedNameSafe(const IceString &Name, const char *Kind, | 67 bool checkIfUnnamedNameSafe(const IceString &Name, const char *Kind, |
70 const IceString &Prefix); | 68 const IceString &Prefix); |
71 | 69 |
(...skipping 10 matching lines...) Expand all Loading... |
82 // Since all constants are globally pooled in the GlobalContext | 80 // Since all constants are globally pooled in the GlobalContext |
83 // object, change all Constant related functions to use | 81 // object, change all Constant related functions to use |
84 // GlobalContext instead of Cfg, and then make emitConstantPool use | 82 // GlobalContext instead of Cfg, and then make emitConstantPool use |
85 // that. | 83 // that. |
86 std::unique_ptr<Cfg> Func; | 84 std::unique_ptr<Cfg> Func; |
87 }; | 85 }; |
88 | 86 |
89 } // end of namespace Ice | 87 } // end of namespace Ice |
90 | 88 |
91 #endif // SUBZERO_SRC_ICETRANSLATOR_H | 89 #endif // SUBZERO_SRC_ICETRANSLATOR_H |
OLD | NEW |