| 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 11 matching lines...) Expand all Loading... |
| 22 class ClFlags; | 22 class ClFlags; |
| 23 class Cfg; | 23 class Cfg; |
| 24 class GlobalContext; | 24 class GlobalContext; |
| 25 | 25 |
| 26 // Base class for translating ICE to machine code. | 26 // Base class for translating ICE to machine code. |
| 27 // Derived classes convert other intermediate representations down to ICE, | 27 // Derived classes convert other intermediate representations down to ICE, |
| 28 // and then call the appropriate (inherited) methods to convert ICE into | 28 // and then call the appropriate (inherited) methods to convert ICE into |
| 29 // machine instructions. | 29 // machine instructions. |
| 30 class Translator { | 30 class Translator { |
| 31 public: | 31 public: |
| 32 Translator(GlobalContext *Ctx) : Ctx(Ctx), ErrorStatus(0) {} | 32 Translator(GlobalContext *Ctx, const ClFlags &Flags) |
| 33 : Ctx(Ctx), Flags(Flags), ErrorStatus(0) {} |
| 33 | 34 |
| 34 ~Translator(); | 35 ~Translator(); |
| 35 bool getErrorStatus() const { return ErrorStatus; } | 36 bool getErrorStatus() const { return ErrorStatus; } |
| 36 | 37 |
| 38 GlobalContext *getContext() const { return Ctx; } |
| 39 |
| 40 const ClFlags &getFlags() const { return Flags; } |
| 41 |
| 42 /// Translates the constructed ICE function Fcn to machine code. |
| 43 /// Takes ownership of Fcn. Note: As a side effect, Field Func is |
| 44 /// set to Fcn. |
| 45 void translateFcn(Cfg *Fcn); |
| 46 |
| 47 /// Emits the constant pool. |
| 48 void emitConstants(); |
| 49 |
| 37 protected: | 50 protected: |
| 38 GlobalContext *Ctx; | 51 GlobalContext *Ctx; |
| 52 const ClFlags &Flags; |
| 39 // The exit status of the translation. False is successful. True | 53 // The exit status of the translation. False is successful. True |
| 40 // otherwise. | 54 // otherwise. |
| 41 bool ErrorStatus; | 55 bool ErrorStatus; |
| 42 // Ideally, Func would be inside the methods that converts IR to | 56 // Ideally, Func would be inside the methods that converts IR to |
| 43 // functions. However, emitting the constant pool requires a valid | 57 // functions. However, emitting the constant pool requires a valid |
| 44 // Cfg object, so we need to defer deleting the last non-empty Cfg | 58 // Cfg object, so we need to defer deleting the last non-empty Cfg |
| 45 // object to emit the constant pool (via emitConstants). TODO: | 59 // object to emit the constant pool (via emitConstants). TODO: |
| 46 // Since all constants are globally pooled in the GlobalContext | 60 // Since all constants are globally pooled in the GlobalContext |
| 47 // object, change all Constant related functions to use | 61 // object, change all Constant related functions to use |
| 48 // GlobalContext instead of Cfg, and then make emitConstantPool use | 62 // GlobalContext instead of Cfg, and then make emitConstantPool use |
| 49 // that. | 63 // that. |
| 50 llvm::OwningPtr<Cfg> Func; | 64 llvm::OwningPtr<Cfg> Func; |
| 51 | 65 |
| 52 /// Translates the constructed ICE function Fcn to machine code. | |
| 53 /// Note: As a side effect, Field Func is set to Fcn. | |
| 54 void translateFcn(Cfg *Fcn); | |
| 55 | |
| 56 /// Emits the constant pool. | |
| 57 void emitConstants(); | |
| 58 | |
| 59 private: | 66 private: |
| 60 Translator(const Translator &) LLVM_DELETED_FUNCTION; | 67 Translator(const Translator &) LLVM_DELETED_FUNCTION; |
| 61 Translator &operator=(const Translator &) LLVM_DELETED_FUNCTION; | 68 Translator &operator=(const Translator &) LLVM_DELETED_FUNCTION; |
| 62 }; | 69 }; |
| 63 } | 70 } |
| 64 | 71 |
| 65 #endif // SUBZERO_SRC_ICETRANSLATOR_H | 72 #endif // SUBZERO_SRC_ICETRANSLATOR_H |
| OLD | NEW |