Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 //===- subzero/src/IceTranslator.h - Translate IR to ICE --------*- C++ -*-===// | |
| 2 // | |
| 3 // The Subzero Code Generator | |
| 4 // | |
| 5 // This file is distributed under the University of Illinois Open Source | |
| 6 // License. See LICENSE.TXT for details. | |
| 7 // | |
| 8 //===----------------------------------------------------------------------===// | |
| 9 // | |
| 10 // This file declares the general driver class for translating IR to ICE. | |
| 11 // | |
| 12 //===----------------------------------------------------------------------===// | |
| 13 | |
| 14 #ifndef SUBZERO_SRC_ICETRANSLATOR_H | |
| 15 #define SUBZERO_SRC_ICETRANSLATOR_H | |
| 16 | |
| 17 #include "llvm/ADT/OwningPtr.h" | |
| 18 | |
| 19 namespace Ice { | |
| 20 | |
| 21 class ClFlags; | |
| 22 class Cfg; | |
| 23 class GlobalContext; | |
| 24 | |
| 25 // Base class for translating ICE to machine code. | |
| 26 // Derived classes convert other intermediate representations downto ICE, | |
|
jvoung (off chromium)
2014/07/02 17:00:15
down to ICE
Karl
2014/07/02 18:09:54
Done.
| |
| 27 // and then call the appropriate (inherited) methods to convert ICE into | |
| 28 // machine instructions. | |
| 29 class Translator { | |
| 30 public: | |
| 31 Translator(GlobalContext *Ctx, ClFlags &Flags) | |
| 32 : Ctx(Ctx), Flags(Flags), ExitStatus(0) {} | |
| 33 | |
| 34 ~Translator(); | |
| 35 | |
| 36 protected: | |
| 37 GlobalContext *Ctx; | |
| 38 ClFlags &Flags; | |
| 39 // The exit status of the translation. 0 is successful. Nonzero | |
| 40 // otherwise. | |
| 41 int ExitStatus; | |
| 42 // Ideally, Func would be inside the methods that converts IR to | |
| 43 // functions. However, emitting the constant pool requires a valid | |
| 44 // Cfg object, so we need to defer deleting the last non-empty Cfg | |
| 45 // object to emit the constant pool (via emitConstants). TODO: | |
| 46 // Since all constants are globally pooled in the Ice::GlobalContext | |
| 47 // object, change all Ice::Constant related functions to use | |
| 48 // GlobalContext instead of Cfg, and then make emitConstantPool use | |
| 49 // that. | |
| 50 llvm::OwningPtr<Ice::Cfg> Func; | |
| 51 | |
| 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(Ice::Cfg *Fcn); | |
| 55 | |
| 56 /// Emits the constant pool. | |
| 57 void emitConstants(); | |
| 58 }; | |
| 59 } | |
| 60 | |
| 61 #endif // SUBZERO_SRC_ICETRANSLATOR_H | |
| OLD | NEW |