OLD | NEW |
---|---|
1 //===- subzero/src/IceConverter.h - Converts LLVM to ICE --------*- C++ -*-===// | 1 //===- subzero/src/IceConverter.h - Converts LLVM to ICE --------*- 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 LLVM to ICE converter. | 10 // This file declares the LLVM to ICE converter. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #ifndef SUBZERO_SRC_ICECONVERTER_H | 14 #ifndef SUBZERO_SRC_ICECONVERTER_H |
15 #define SUBZERO_SRC_ICECONVERTER_H | 15 #define SUBZERO_SRC_ICECONVERTER_H |
16 | 16 |
17 #include "IceDefs.h" | |
17 #include "IceTranslator.h" | 18 #include "IceTranslator.h" |
18 | 19 |
19 namespace llvm { | 20 namespace llvm { |
21 class GlobalValue; | |
20 class Module; | 22 class Module; |
21 } | 23 } |
22 | 24 |
23 namespace Ice { | 25 namespace Ice { |
24 | 26 |
25 class Converter : public Translator { | 27 class Converter : public Translator { |
26 public: | 28 public: |
29 typedef std::map<const llvm::GlobalValue *, GlobalAddress *> | |
30 GlobalAddressMapType; | |
27 Converter(llvm::Module *Mod, GlobalContext *Ctx, const Ice::ClFlags &Flags) | 31 Converter(llvm::Module *Mod, GlobalContext *Ctx, const Ice::ClFlags &Flags) |
28 : Translator(Ctx, Flags), Mod(Mod) {} | 32 : Translator(Ctx, Flags), Mod(Mod) {} |
29 | 33 |
34 ~Converter() {} | |
jvoung (off chromium)
2014/10/10 01:47:28
override?
Karl
2014/10/10 20:17:30
Why. A translator doesn't have any virtual methods
| |
35 | |
30 /// Converts the LLVM Module to ICE. Sets exit status to false if successful, | 36 /// Converts the LLVM Module to ICE. Sets exit status to false if successful, |
31 /// true otherwise. | 37 /// true otherwise. |
32 void convertToIce(); | 38 void convertToIce(); |
33 | 39 |
40 llvm::Module *getModule() { return Mod; } | |
jvoung (off chromium)
2014/10/10 01:47:28
method is "const"?
Karl
2014/10/10 20:17:30
Done.
| |
41 | |
42 // Returns the global address associated with the corresponding global value | |
43 // V. | |
44 // Returns nullptr if no such global address. | |
45 GlobalAddress *getGlobalAddress(const llvm::GlobalValue *V); | |
46 | |
34 private: | 47 private: |
35 llvm::Module *Mod; | 48 llvm::Module *Mod; |
49 GlobalAddressMapType GlobalAddressMap; | |
36 // Converts functions to ICE, and then machine code. | 50 // Converts functions to ICE, and then machine code. |
37 void convertFunctions(); | 51 void convertFunctions(); |
38 | 52 |
39 // Converts globals to ICE, and then machine code. | 53 // Converts globals to ICE, and then machine code. |
40 void convertGlobals(llvm::Module *Mod); | 54 void convertGlobals(llvm::Module *Mod); |
41 | 55 |
56 // Installs global addresses into GlobalAddressMap. | |
57 void installGlobalAddresses(llvm::Module *Mod); | |
58 | |
42 Converter(const Converter &) = delete; | 59 Converter(const Converter &) = delete; |
43 Converter &operator=(const Converter &) = delete; | 60 Converter &operator=(const Converter &) = delete; |
44 }; | 61 }; |
45 | 62 |
46 } // end of namespace ICE. | 63 } // end of namespace ICE. |
47 | 64 |
48 #endif // SUBZERO_SRC_ICECONVERTER_H | 65 #endif // SUBZERO_SRC_ICECONVERTER_H |
OLD | NEW |