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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crosstest/test_global_main.cpp ('k') | src/IceConverter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceConverter.h
diff --git a/src/IceConverter.h b/src/IceConverter.h
index 763dcaeb4f13010ed5534b1474770f00cc781ba8..d26c34c0fd66cc146c9857868a8fcd53d828574f 100644
--- a/src/IceConverter.h
+++ b/src/IceConverter.h
@@ -14,9 +14,11 @@
#ifndef SUBZERO_SRC_ICECONVERTER_H
#define SUBZERO_SRC_ICECONVERTER_H
+#include "IceDefs.h"
#include "IceTranslator.h"
namespace llvm {
+class GlobalValue;
class Module;
}
@@ -27,18 +29,42 @@ public:
Converter(llvm::Module *Mod, GlobalContext *Ctx, const Ice::ClFlags &Flags)
: Translator(Ctx, Flags), Mod(Mod) {}
+ ~Converter() {}
+
/// Converts the LLVM Module to ICE. Sets exit status to false if successful,
/// true otherwise.
void convertToIce();
+ llvm::Module *getModule() const { return Mod; }
+
+ // Returns the global declaration associated with the corresponding
+ // global value V. If no such global address, generates fatal error.
+ GlobalDeclaration *getGlobalDeclaration(const llvm::GlobalValue *V);
+
private:
llvm::Module *Mod;
+ typedef std::map<const llvm::GlobalValue *, GlobalDeclaration *>
+ GlobalDeclarationMapType;
+ GlobalDeclarationMapType GlobalDeclarationMap;
+
+ // Walks module and generates names for unnamed globals using prefix
+ // getFlags().DefaultGlobalPrefix, if the prefix is non-empty.
+ void nameUnnamedGlobalVariables(llvm::Module *Mod);
+
+ // Walks module and generates names for unnamed functions using
+ // prefix getFlags().DefaultFunctionPrefix, if the prefix is
+ // non-empty.
+ void nameUnnamedFunctions(llvm::Module *Mod);
+
// Converts functions to ICE, and then machine code.
void convertFunctions();
// Converts globals to ICE, and then machine code.
void convertGlobals(llvm::Module *Mod);
+ // Installs global declarations into GlobalDeclarationMap.
+ void installGlobalDeclarations(llvm::Module *Mod);
+
Converter(const Converter &) = delete;
Converter &operator=(const Converter &) = delete;
};
« 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