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

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: Clean up code and fix nits. 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
Index: src/IceConverter.h
diff --git a/src/IceConverter.h b/src/IceConverter.h
index 763dcaeb4f13010ed5534b1474770f00cc781ba8..aec65d9c8e0a65bdcc36fcf875fde6b39da8bb8a 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;
}
@@ -24,21 +26,36 @@ namespace Ice {
class Converter : public Translator {
public:
+ typedef std::map<const llvm::GlobalValue *, GlobalAddress *>
+ GlobalAddressMapType;
Converter(llvm::Module *Mod, GlobalContext *Ctx, const Ice::ClFlags &Flags)
: Translator(Ctx, Flags), Mod(Mod) {}
+ ~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
+
/// Converts the LLVM Module to ICE. Sets exit status to false if successful,
/// true otherwise.
void convertToIce();
+ 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.
+
+ // Returns the global address associated with the corresponding global value
+ // V.
+ // Returns nullptr if no such global address.
+ GlobalAddress *getGlobalAddress(const llvm::GlobalValue *V);
+
private:
llvm::Module *Mod;
+ GlobalAddressMapType GlobalAddressMap;
// 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 addresses into GlobalAddressMap.
+ void installGlobalAddresses(llvm::Module *Mod);
+
Converter(const Converter &) = delete;
Converter &operator=(const Converter &) = delete;
};

Powered by Google App Engine
This is Rietveld 408576698