Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Making it compilable with llvm 3.0.

- removed consts
- std::vector(s) wrapped with ArrayRef
- InitializeNativeTarget() is now in Support/TargetSelect.h
commit 1bd8d369b8d03aca7e0e9278e226c1c49bd6ee6e 1 parent 1533b2c
@dubik dubik authored
Showing with 7 additions and 7 deletions.
  1. +6 −6 codegen.cpp
  2. +1 −1  codegen.h
View
12 codegen.cpp
@@ -10,8 +10,8 @@ void CodeGenContext::generateCode(NBlock& root)
std::cout << "Generating code...\n";
/* Create the top level interpreter function to call as entry */
- vector<const Type*> argTypes;
- FunctionType *ftype = FunctionType::get(Type::getVoidTy(getGlobalContext()), argTypes, false);
+ vector<Type*> argTypes;
+ FunctionType *ftype = FunctionType::get(Type::getVoidTy(getGlobalContext()), makeArrayRef(argTypes), false);
mainFunction = Function::Create(ftype, GlobalValue::InternalLinkage, "main", module);
BasicBlock *bblock = BasicBlock::Create(getGlobalContext(), "entry", mainFunction, 0);
@@ -41,7 +41,7 @@ GenericValue CodeGenContext::runCode() {
}
/* Returns an LLVM type based on the identifier */
-static const Type *typeOf(const NIdentifier& type)
+static Type *typeOf(const NIdentifier& type)
{
if (type.name.compare("int") == 0) {
return Type::getInt64Ty(getGlobalContext());
@@ -87,7 +87,7 @@ Value* NMethodCall::codeGen(CodeGenContext& context)
for (it = arguments.begin(); it != arguments.end(); it++) {
args.push_back((**it).codeGen(context));
}
- CallInst *call = CallInst::Create(function, args.begin(), args.end(), "", context.currentBlock());
+ CallInst *call = CallInst::Create(function, makeArrayRef(args), "", context.currentBlock());
std::cout << "Creating method call: " << id.name << endl;
return call;
}
@@ -153,12 +153,12 @@ Value* NVariableDeclaration::codeGen(CodeGenContext& context)
Value* NFunctionDeclaration::codeGen(CodeGenContext& context)
{
- vector<const Type*> argTypes;
+ vector<Type*> argTypes;
VariableList::const_iterator it;
for (it = arguments.begin(); it != arguments.end(); it++) {
argTypes.push_back(typeOf((**it).type));
}
- FunctionType *ftype = FunctionType::get(typeOf(type), argTypes, false);
+ FunctionType *ftype = FunctionType::get(typeOf(type), makeArrayRef(argTypes), false);
Function *function = Function::Create(ftype, GlobalValue::InternalLinkage, id.name.c_str(), context.module);
BasicBlock *bblock = BasicBlock::Create(getGlobalContext(), "entry", function, 0);
View
2  codegen.h
@@ -13,7 +13,7 @@
#include <llvm/Assembly/PrintModulePass.h>
#include <llvm/Support/IRBuilder.h>
//#include <llvm/ModuleProvider.h>
-#include <llvm/Target/TargetSelect.h>
+#include <llvm/Support/TargetSelect.h>
#include <llvm/ExecutionEngine/GenericValue.h>
#include <llvm/ExecutionEngine/JIT.h>
#include <llvm/Support/raw_ostream.h>
Please sign in to comment.
Something went wrong with that request. Please try again.