Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: src/IceConverter.h

Issue 641193002: Introduce the notion of function addresses in Subzero. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nit in test. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crosstest/test_global_main.cpp ('k') | src/IceConverter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:
27 Converter(llvm::Module *Mod, GlobalContext *Ctx, const Ice::ClFlags &Flags) 29 Converter(llvm::Module *Mod, GlobalContext *Ctx, const Ice::ClFlags &Flags)
28 : Translator(Ctx, Flags), Mod(Mod) {} 30 : Translator(Ctx, Flags), Mod(Mod) {}
29 31
32 ~Converter() {}
33
30 /// Converts the LLVM Module to ICE. Sets exit status to false if successful, 34 /// Converts the LLVM Module to ICE. Sets exit status to false if successful,
31 /// true otherwise. 35 /// true otherwise.
32 void convertToIce(); 36 void convertToIce();
33 37
38 llvm::Module *getModule() const { return Mod; }
39
40 // Returns the global declaration associated with the corresponding
41 // global value V. If no such global address, generates fatal error.
42 GlobalDeclaration *getGlobalDeclaration(const llvm::GlobalValue *V);
43
34 private: 44 private:
35 llvm::Module *Mod; 45 llvm::Module *Mod;
46 typedef std::map<const llvm::GlobalValue *, GlobalDeclaration *>
47 GlobalDeclarationMapType;
48 GlobalDeclarationMapType GlobalDeclarationMap;
49
50 // Walks module and generates names for unnamed globals using prefix
51 // getFlags().DefaultGlobalPrefix, if the prefix is non-empty.
52 void nameUnnamedGlobalVariables(llvm::Module *Mod);
53
54 // Walks module and generates names for unnamed functions using
55 // prefix getFlags().DefaultFunctionPrefix, if the prefix is
56 // non-empty.
57 void nameUnnamedFunctions(llvm::Module *Mod);
58
36 // Converts functions to ICE, and then machine code. 59 // Converts functions to ICE, and then machine code.
37 void convertFunctions(); 60 void convertFunctions();
38 61
39 // Converts globals to ICE, and then machine code. 62 // Converts globals to ICE, and then machine code.
40 void convertGlobals(llvm::Module *Mod); 63 void convertGlobals(llvm::Module *Mod);
41 64
65 // Installs global declarations into GlobalDeclarationMap.
66 void installGlobalDeclarations(llvm::Module *Mod);
67
42 Converter(const Converter &) = delete; 68 Converter(const Converter &) = delete;
43 Converter &operator=(const Converter &) = delete; 69 Converter &operator=(const Converter &) = delete;
44 }; 70 };
45 71
46 } // end of namespace ICE. 72 } // end of namespace ICE.
47 73
48 #endif // SUBZERO_SRC_ICECONVERTER_H 74 #endif // SUBZERO_SRC_ICECONVERTER_H
OLDNEW
« no previous file with comments | « crosstest/test_global_main.cpp ('k') | src/IceConverter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698