| 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 |
| 11 // machine code. | 11 // machine code. |
| 12 // | 12 // |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICETRANSLATOR_H | 15 #ifndef SUBZERO_SRC_ICETRANSLATOR_H |
| 16 #define SUBZERO_SRC_ICETRANSLATOR_H | 16 #define SUBZERO_SRC_ICETRANSLATOR_H |
| 17 | 17 |
| 18 #include "llvm/ADT/OwningPtr.h" | 18 #include "llvm/ADT/OwningPtr.h" |
| 19 | 19 |
| 20 namespace llvm { |
| 21 class Module; |
| 22 } |
| 23 |
| 20 namespace Ice { | 24 namespace Ice { |
| 21 | 25 |
| 22 class ClFlags; | 26 class ClFlags; |
| 23 class Cfg; | 27 class Cfg; |
| 24 class GlobalContext; | 28 class GlobalContext; |
| 25 | 29 |
| 26 // Base class for translating ICE to machine code. | 30 // Base class for translating ICE to machine code. |
| 27 // Derived classes convert other intermediate representations down to ICE, | 31 // Derived classes convert other intermediate representations down to ICE, |
| 28 // and then call the appropriate (inherited) methods to convert ICE into | 32 // and then call the appropriate (inherited) methods to convert ICE into |
| 29 // machine instructions. | 33 // machine instructions. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 const ClFlags &getFlags() const { return Flags; } | 44 const ClFlags &getFlags() const { return Flags; } |
| 41 | 45 |
| 42 /// Translates the constructed ICE function Fcn to machine code. | 46 /// Translates the constructed ICE function Fcn to machine code. |
| 43 /// Takes ownership of Fcn. Note: As a side effect, Field Func is | 47 /// Takes ownership of Fcn. Note: As a side effect, Field Func is |
| 44 /// set to Fcn. | 48 /// set to Fcn. |
| 45 void translateFcn(Cfg *Fcn); | 49 void translateFcn(Cfg *Fcn); |
| 46 | 50 |
| 47 /// Emits the constant pool. | 51 /// Emits the constant pool. |
| 48 void emitConstants(); | 52 void emitConstants(); |
| 49 | 53 |
| 54 // Walks module and generates names for unnamed globals and |
| 55 // functions using prefix getFlags().DefaultGlobalPrefix, if the |
| 56 // prefix is non-empty. |
| 57 void nameUnnamedGlobalAddresses(llvm::Module *Mod); |
| 58 |
| 50 protected: | 59 protected: |
| 51 GlobalContext *Ctx; | 60 GlobalContext *Ctx; |
| 52 const ClFlags &Flags; | 61 const ClFlags &Flags; |
| 53 // The exit status of the translation. False is successful. True | 62 // The exit status of the translation. False is successful. True |
| 54 // otherwise. | 63 // otherwise. |
| 55 bool ErrorStatus; | 64 bool ErrorStatus; |
| 56 // Ideally, Func would be inside the methods that converts IR to | 65 // Ideally, Func would be inside the methods that converts IR to |
| 57 // functions. However, emitting the constant pool requires a valid | 66 // functions. However, emitting the constant pool requires a valid |
| 58 // Cfg object, so we need to defer deleting the last non-empty Cfg | 67 // Cfg object, so we need to defer deleting the last non-empty Cfg |
| 59 // object to emit the constant pool (via emitConstants). TODO: | 68 // object to emit the constant pool (via emitConstants). TODO: |
| 60 // Since all constants are globally pooled in the GlobalContext | 69 // Since all constants are globally pooled in the GlobalContext |
| 61 // object, change all Constant related functions to use | 70 // object, change all Constant related functions to use |
| 62 // GlobalContext instead of Cfg, and then make emitConstantPool use | 71 // GlobalContext instead of Cfg, and then make emitConstantPool use |
| 63 // that. | 72 // that. |
| 64 llvm::OwningPtr<Cfg> Func; | 73 llvm::OwningPtr<Cfg> Func; |
| 65 | 74 |
| 66 private: | 75 private: |
| 67 Translator(const Translator &) LLVM_DELETED_FUNCTION; | 76 Translator(const Translator &) LLVM_DELETED_FUNCTION; |
| 68 Translator &operator=(const Translator &) LLVM_DELETED_FUNCTION; | 77 Translator &operator=(const Translator &) LLVM_DELETED_FUNCTION; |
| 69 }; | 78 }; |
| 70 } | 79 } |
| 71 | 80 |
| 72 #endif // SUBZERO_SRC_ICETRANSLATOR_H | 81 #endif // SUBZERO_SRC_ICETRANSLATOR_H |
| OLD | NEW |