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 /// \file | 10 /// \file |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace Ice { | 26 namespace Ice { |
27 | 27 |
28 class Converter : public Translator { | 28 class Converter : public Translator { |
29 Converter() = delete; | 29 Converter() = delete; |
30 Converter(const Converter &) = delete; | 30 Converter(const Converter &) = delete; |
31 Converter &operator=(const Converter &) = delete; | 31 Converter &operator=(const Converter &) = delete; |
32 | 32 |
33 public: | 33 public: |
34 Converter(llvm::Module *Mod, GlobalContext *Ctx) | 34 Converter(llvm::Module *Mod, GlobalContext *Ctx) |
35 : Translator(Ctx), Mod(Mod) {} | 35 : Translator(Ctx), Mod(Mod), |
| 36 GlobalDeclarationsPool(new VariableDeclarationList()) {} |
36 | 37 |
37 ~Converter() override = default; | 38 ~Converter() override = default; |
38 | 39 |
39 /// Converts the LLVM Module to ICE. Sets exit status to false if successful, | 40 /// Converts the LLVM Module to ICE. Sets exit status to false if successful, |
40 /// true otherwise. | 41 /// true otherwise. |
41 void convertToIce(); | 42 void convertToIce(); |
42 | 43 |
43 llvm::Module *getModule() const { return Mod; } | 44 llvm::Module *getModule() const { return Mod; } |
44 | 45 |
45 /// Returns the global declaration associated with the corresponding global | 46 /// Returns the global declaration associated with the corresponding global |
46 /// value V. If no such global address, generates fatal error. | 47 /// value V. If no such global address, generates fatal error. |
47 GlobalDeclaration *getGlobalDeclaration(const llvm::GlobalValue *V); | 48 GlobalDeclaration *getGlobalDeclaration(const llvm::GlobalValue *V); |
48 | 49 |
49 private: | 50 private: |
50 llvm::Module *Mod; | 51 llvm::Module *Mod; |
51 using GlobalDeclarationMapType = | 52 using GlobalDeclarationMapType = |
52 std::map<const llvm::GlobalValue *, GlobalDeclaration *>; | 53 std::map<const llvm::GlobalValue *, GlobalDeclaration *>; |
53 GlobalDeclarationMapType GlobalDeclarationMap; | 54 GlobalDeclarationMapType GlobalDeclarationMap; |
54 | 55 |
| 56 std::unique_ptr<VariableDeclarationList> GlobalDeclarationsPool; |
| 57 |
55 /// Walks module and generates names for unnamed globals using prefix | 58 /// Walks module and generates names for unnamed globals using prefix |
56 /// getFlags().DefaultGlobalPrefix, if the prefix is non-empty. | 59 /// getFlags().DefaultGlobalPrefix, if the prefix is non-empty. |
57 void nameUnnamedGlobalVariables(llvm::Module *Mod); | 60 void nameUnnamedGlobalVariables(llvm::Module *Mod); |
58 | 61 |
59 /// Walks module and generates names for unnamed functions using prefix | 62 /// Walks module and generates names for unnamed functions using prefix |
60 /// getFlags().DefaultFunctionPrefix, if the prefix is non-empty. | 63 /// getFlags().DefaultFunctionPrefix, if the prefix is non-empty. |
61 void nameUnnamedFunctions(llvm::Module *Mod); | 64 void nameUnnamedFunctions(llvm::Module *Mod); |
62 | 65 |
63 /// Converts functions to ICE, and then machine code. | 66 /// Converts functions to ICE, and then machine code. |
64 void convertFunctions(); | 67 void convertFunctions(); |
65 | 68 |
66 /// Converts globals to ICE, and then machine code. | 69 /// Converts globals to ICE, and then machine code. |
67 void convertGlobals(llvm::Module *Mod); | 70 void convertGlobals(llvm::Module *Mod); |
68 | 71 |
69 /// Installs global declarations into GlobalDeclarationMap. | 72 /// Installs global declarations into GlobalDeclarationMap. |
70 void installGlobalDeclarations(llvm::Module *Mod); | 73 void installGlobalDeclarations(llvm::Module *Mod); |
71 }; | 74 }; |
72 | 75 |
73 } // end of namespace ICE. | 76 } // end of namespace ICE. |
74 | 77 |
75 #endif // SUBZERO_SRC_ICECONVERTER_H | 78 #endif // SUBZERO_SRC_ICECONVERTER_H |
OLD | NEW |