Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 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, ClFlags &Flags) | 32 Translator(GlobalContext *Ctx, ClFlags &Flags) |
| 33 : Ctx(Ctx), Flags(Flags), ErrorStatus(0) {} | 33 : Ctx(Ctx), Flags(Flags), ErrorStatus(0) {} |
| 34 | 34 |
| 35 ~Translator(); | 35 ~Translator(); |
| 36 bool getErrorStatus() const { return ErrorStatus; } | 36 bool getErrorStatus() const { return ErrorStatus; } |
| 37 | 37 |
| 38 GlobalContext *getContext() { | |
|
Jim Stichnoth
2014/07/17 23:00:33
Can getContext be const?
(Also, I'm surprised cla
Karl
2014/07/18 20:27:42
Don't know why this wasn't converted. Ran clang-fo
| |
| 39 return Ctx; | |
| 40 } | |
| 41 | |
| 42 ClFlags &getFlags() { | |
| 43 return Flags; | |
| 44 } | |
| 45 | |
| 46 /// Translates the constructed ICE function Fcn to machine code. | |
| 47 /// Note: As a side effect, Field Func is set to Fcn. | |
| 48 void translateFcn(Cfg *Fcn); | |
| 49 | |
| 50 /// Emits the constant pool. | |
| 51 void emitConstants(); | |
| 52 | |
| 38 protected: | 53 protected: |
| 39 GlobalContext *Ctx; | 54 GlobalContext *Ctx; |
| 40 ClFlags &Flags; | 55 ClFlags &Flags; |
| 41 // The exit status of the translation. False is successful. True | 56 // The exit status of the translation. False is successful. True |
| 42 // otherwise. | 57 // otherwise. |
| 43 bool ErrorStatus; | 58 bool ErrorStatus; |
| 44 // Ideally, Func would be inside the methods that converts IR to | 59 // Ideally, Func would be inside the methods that converts IR to |
| 45 // functions. However, emitting the constant pool requires a valid | 60 // functions. However, emitting the constant pool requires a valid |
| 46 // Cfg object, so we need to defer deleting the last non-empty Cfg | 61 // Cfg object, so we need to defer deleting the last non-empty Cfg |
| 47 // object to emit the constant pool (via emitConstants). TODO: | 62 // object to emit the constant pool (via emitConstants). TODO: |
| 48 // Since all constants are globally pooled in the GlobalContext | 63 // Since all constants are globally pooled in the GlobalContext |
| 49 // object, change all Constant related functions to use | 64 // object, change all Constant related functions to use |
| 50 // GlobalContext instead of Cfg, and then make emitConstantPool use | 65 // GlobalContext instead of Cfg, and then make emitConstantPool use |
| 51 // that. | 66 // that. |
| 52 llvm::OwningPtr<Cfg> Func; | 67 llvm::OwningPtr<Cfg> Func; |
| 53 | 68 |
| 54 /// Translates the constructed ICE function Fcn to machine code. | |
| 55 /// Note: As a side effect, Field Func is set to Fcn. | |
| 56 void translateFcn(Cfg *Fcn); | |
| 57 | |
| 58 /// Emits the constant pool. | |
| 59 void emitConstants(); | |
| 60 | |
| 61 private: | 69 private: |
| 62 Translator(const Translator &) LLVM_DELETED_FUNCTION; | 70 Translator(const Translator &) LLVM_DELETED_FUNCTION; |
| 63 Translator &operator=(const Translator &) LLVM_DELETED_FUNCTION; | 71 Translator &operator=(const Translator &) LLVM_DELETED_FUNCTION; |
| 64 }; | 72 }; |
| 65 } | 73 } |
| 66 | 74 |
| 67 #endif // SUBZERO_SRC_ICETRANSLATOR_H | 75 #endif // SUBZERO_SRC_ICETRANSLATOR_H |
| OLD | NEW |