Introduce the notion of function addresses in Subzero.
Introduces the notion of a function address, to replace using LLVM
IR's Function class. Modifies Ice converter, and Subzero's bitcode
reader, to build function addresses.
BUG=None
R=jvoung@chromium.org, stichnot@chromium.org
Review URL: https://codereview.chromium.org/641193002
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index c8b429f..b724433 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -19,6 +19,7 @@
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceGlobalContext.h"
+#include "IceGlobalInits.h"
#include "IceOperand.h"
#include "IceTargetLowering.h"
#include "IceTimerTree.h"
@@ -289,7 +290,9 @@
return getTestPrefix() + Name;
}
-GlobalContext::~GlobalContext() {}
+GlobalContext::~GlobalContext() {
+ llvm::DeleteContainerPointers(GlobalDeclarations);
+}
Constant *GlobalContext::getConstantInt64(Type Ty, uint64_t ConstantInt64) {
assert(Ty == IceType_i64);
@@ -385,6 +388,23 @@
llvm_unreachable("Unknown type");
}
+FunctionDeclaration *
+GlobalContext::newFunctionDeclaration(const FuncSigType *Signature,
+ unsigned CallingConv, unsigned Linkage,
+ bool IsProto) {
+ FunctionDeclaration *Func = new FunctionDeclaration(
+ *Signature, static_cast<llvm::CallingConv::ID>(CallingConv),
+ static_cast<llvm::GlobalValue::LinkageTypes>(Linkage), IsProto);
+ GlobalDeclarations.push_back(Func);
+ return Func;
+}
+
+VariableDeclaration *GlobalContext::newVariableDeclaration() {
+ VariableDeclaration *Var = new VariableDeclaration();
+ GlobalDeclarations.push_back(Var);
+ return Var;
+}
+
TimerIdT GlobalContext::getTimerID(TimerStackIdT StackID,
const IceString &Name) {
assert(StackID < Timers.size());