| 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 16 matching lines...) Expand all Loading... |
| 27 class GlobalContext; | 27 class GlobalContext; |
| 28 | 28 |
| 29 // Base class for translating ICE to machine code. Derived classes convert | 29 // Base class for translating ICE to machine code. Derived classes convert |
| 30 // other intermediate representations down to ICE, and then call the appropriate | 30 // other intermediate representations down to ICE, and then call the appropriate |
| 31 // (inherited) methods to convert ICE into machine instructions. | 31 // (inherited) methods to convert ICE into machine instructions. |
| 32 class Translator { | 32 class Translator { |
| 33 Translator(const Translator &) = delete; | 33 Translator(const Translator &) = delete; |
| 34 Translator &operator=(const Translator &) = delete; | 34 Translator &operator=(const Translator &) = delete; |
| 35 | 35 |
| 36 public: | 36 public: |
| 37 Translator(GlobalContext *Ctx, const ClFlags &Flags); | 37 Translator(GlobalContext *Ctx); |
| 38 | 38 |
| 39 ~Translator(); | 39 ~Translator(); |
| 40 const ErrorCode &getErrorStatus() const { return ErrorStatus; } | 40 const ErrorCode &getErrorStatus() const { return ErrorStatus; } |
| 41 | 41 |
| 42 GlobalContext *getContext() const { return Ctx; } | 42 GlobalContext *getContext() const { return Ctx; } |
| 43 | 43 |
| 44 const ClFlags &getFlags() const { return Flags; } | 44 const ClFlags &getFlags() const { return Ctx->getFlags(); } |
| 45 | 45 |
| 46 /// Translates the constructed ICE function Fcn to machine code. | 46 /// Translates the constructed ICE function Fcn to machine code. |
| 47 /// Takes ownership of Func. | 47 /// Takes ownership of Func. |
| 48 void translateFcn(std::unique_ptr<Cfg> Func); | 48 void translateFcn(std::unique_ptr<Cfg> Func); |
| 49 | 49 |
| 50 /// Emits the constant pool. | 50 /// Emits the constant pool. |
| 51 void emitConstants(); | 51 void emitConstants(); |
| 52 | 52 |
| 53 /// If there was an error during bitcode reading/parsing, copy the | 53 /// If there was an error during bitcode reading/parsing, copy the |
| 54 /// error code into the GlobalContext. | 54 /// error code into the GlobalContext. |
| 55 void transferErrorCode() const; | 55 void transferErrorCode() const; |
| 56 | 56 |
| 57 /// Lowers the given list of global addresses to target. Generates | 57 /// Lowers the given list of global addresses to target. Generates |
| 58 /// list of corresponding variable declarations. | 58 /// list of corresponding variable declarations. |
| 59 void lowerGlobals(const VariableDeclarationList &VariableDeclarations); | 59 void lowerGlobals(VariableDeclarationList *VariableDeclarations); |
| 60 | 60 |
| 61 /// Creates a name using the given prefix and corresponding index. | 61 /// Creates a name using the given prefix and corresponding index. |
| 62 std::string createUnnamedName(const IceString &Prefix, SizeT Index); | 62 std::string createUnnamedName(const IceString &Prefix, SizeT Index); |
| 63 | 63 |
| 64 /// Reports if there is a (potential) conflict between Name, and using | 64 /// Reports if there is a (potential) conflict between Name, and using |
| 65 /// Prefix to name unnamed names. Errors are put on Ostream. | 65 /// Prefix to name unnamed names. Errors are put on Ostream. |
| 66 /// Returns true if there isn't a potential conflict. | 66 /// Returns true if there isn't a potential conflict. |
| 67 bool checkIfUnnamedNameSafe(const IceString &Name, const char *Kind, | 67 bool checkIfUnnamedNameSafe(const IceString &Name, const char *Kind, |
| 68 const IceString &Prefix); | 68 const IceString &Prefix); |
| 69 | 69 |
| 70 uint32_t getNextSequenceNumber() { return NextSequenceNumber++; } |
| 71 |
| 70 protected: | 72 protected: |
| 71 GlobalContext *Ctx; | 73 GlobalContext *Ctx; |
| 72 const ClFlags &Flags; | 74 uint32_t NextSequenceNumber; |
| 73 std::unique_ptr<TargetDataLowering> DataLowering; | |
| 74 // Exit status of the translation. False is successful. True otherwise. | 75 // Exit status of the translation. False is successful. True otherwise. |
| 75 ErrorCode ErrorStatus; | 76 ErrorCode ErrorStatus; |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 } // end of namespace Ice | 79 } // end of namespace Ice |
| 79 | 80 |
| 80 #endif // SUBZERO_SRC_ICETRANSLATOR_H | 81 #endif // SUBZERO_SRC_ICETRANSLATOR_H |
| OLD | NEW |