Skip to content

Commit

Permalink
make llvm 3.2 work
Browse files Browse the repository at this point in the history
  • Loading branch information
Gibheer committed Nov 24, 2012
1 parent 55fad50 commit d67a3b0
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 28 deletions.
5 changes: 5 additions & 0 deletions vm/llvm/autotypes.cpp
@@ -1,6 +1,11 @@
#ifdef ENABLE_LLVM

#include "vm/config.h"
#if RBX_LLVM_API_VER >= 302
#include <llvm/DataLayout.h>
#else
#include <llvm/Target/TargetData.h>
#endif
// #include <llvm/LinkAllPasses.h>
#include <llvm/Analysis/Verifier.h>
#include <llvm/Transforms/Scalar.h>
Expand Down
6 changes: 3 additions & 3 deletions vm/llvm/inline_primitive.cpp
Expand Up @@ -646,7 +646,7 @@ namespace rubinius {
sig << "State";

Function* func = sig.function("rbx_float_allocate");
func->setDoesNotAlias(0, true); // return value
func->setDoesNotAlias(0); // return value

Value* call_args[] = { ops.vm() };
CallInst* res = sig.call("rbx_float_allocate", call_args, 1, "result", ops.b());
Expand Down Expand Up @@ -1091,10 +1091,10 @@ namespace rubinius {
}

Function* func = sig.function(stub_res.name());
func->setDoesNotCapture(1, true);
func->setDoesNotCapture(1);

if(stub_res.pass_callframe()) {
func->setDoesNotCapture(2, true);
func->setDoesNotCapture(2);
}

Value* res = sig.call(stub_res.name(), call_args, "prim_value", ops_.b());
Expand Down
8 changes: 4 additions & 4 deletions vm/llvm/jit_block.cpp
Expand Up @@ -460,13 +460,13 @@ namespace jit {
};

Function* func = sig.function("rbx_construct_splat");
func->setOnlyReadsMemory(true);
func->setDoesNotThrow(true);
func->setOnlyReadsMemory();
func->setDoesNotThrow();

CallInst* splat_val = sig.call("rbx_construct_splat", call_args, 4, "splat_val", b());

splat_val->setOnlyReadsMemory(true);
splat_val->setDoesNotThrow(true);
splat_val->setOnlyReadsMemory();
splat_val->setDoesNotThrow();

Value* idx3[] = {
cint(0),
Expand Down
4 changes: 2 additions & 2 deletions vm/llvm/jit_builder.cpp
Expand Up @@ -552,8 +552,8 @@ namespace jit {
sig << "CallFrame";

Function* func_ci = sig.function("rbx_check_interrupts");
func_ci->setDoesNotCapture(1, true);
func_ci->setDoesNotCapture(2, true);
func_ci->setDoesNotCapture(1);
func_ci->setDoesNotCapture(2);

Value* call_args[] = { info_.vm(), call_frame };

Expand Down
4 changes: 4 additions & 0 deletions vm/llvm/jit_builder.hpp
Expand Up @@ -6,7 +6,11 @@
#include "llvm/basic_block.hpp"
#include "llvm/inline_block.hpp"
#include "llvm/offset.hpp"
#if RBX_LLVM_API_VER >= 302
#include <llvm/IRBuilder.h>
#else
#include <llvm/Support/IRBuilder.h>
#endif

namespace rubinius {
class InlinePolicy;
Expand Down
5 changes: 4 additions & 1 deletion vm/llvm/jit_compiler.cpp
Expand Up @@ -14,8 +14,11 @@

#include "objectmemory.hpp"

#if RBX_LLVM_API_VER >= 302
#include <llvm/DataLayout.h>
#else
#include <llvm/Target/TargetData.h>
// #include <llvm/LinkAllPasses.h>
#endif
#include <llvm/Analysis/Verifier.h>
#include <llvm/Transforms/Scalar.h>
#include <llvm/CallingConv.h>
Expand Down
16 changes: 8 additions & 8 deletions vm/llvm/jit_method.cpp
Expand Up @@ -248,13 +248,13 @@ namespace jit {
};

Function* func = sig.function("rbx_construct_splat");
func->setOnlyReadsMemory(true);
func->setDoesNotThrow(true);
func->setOnlyReadsMemory();
func->setDoesNotThrow();

CallInst* splat_val = sig.call("rbx_construct_splat", call_args, 4, "splat_val", b());

splat_val->setOnlyReadsMemory(true);
splat_val->setDoesNotThrow(true);
splat_val->setOnlyReadsMemory();
splat_val->setDoesNotThrow();

Value* idx3[] = {
cint(0),
Expand Down Expand Up @@ -381,13 +381,13 @@ namespace jit {
};

Function* func = sig.function("rbx_construct_splat");
func->setOnlyReadsMemory(true);
func->setDoesNotThrow(true);
func->setOnlyReadsMemory();
func->setDoesNotThrow();

CallInst* splat_val = sig.call("rbx_construct_splat", call_args, 4, "splat_val", b());

splat_val->setOnlyReadsMemory(true);
splat_val->setDoesNotThrow(true);
splat_val->setOnlyReadsMemory();
splat_val->setDoesNotThrow();

Value* idx3[] = {
cint(0),
Expand Down
4 changes: 4 additions & 0 deletions vm/llvm/jit_operations.hpp
Expand Up @@ -21,7 +21,11 @@
#include <llvm/Value.h>
#include <llvm/BasicBlock.h>
#include <llvm/Function.h>
#if RBX_LLVM_API_VER >= 302
#include <llvm/IRBuilder.h>
#else
#include <llvm/Support/IRBuilder.h>
#endif
#include <llvm/CallingConv.h>

using namespace llvm;
Expand Down
14 changes: 7 additions & 7 deletions vm/llvm/jit_visit.hpp
Expand Up @@ -2076,8 +2076,8 @@ namespace rubinius {
Function* func = cast<Function>(
module_->getOrInsertFunction("rbx_push_const_fast", ft));

func->setOnlyReadsMemory(true);
func->setDoesNotThrow(true);
func->setOnlyReadsMemory();
func->setDoesNotThrow();

flush();

Expand All @@ -2091,8 +2091,8 @@ namespace rubinius {
CallInst* ret = b().CreateCall(func, call_args,
"push_const_fast");

ret->setOnlyReadsMemory(true);
ret->setDoesNotThrow(true);
ret->setOnlyReadsMemory();
ret->setDoesNotThrow();

check_for_exception(ret);

Expand Down Expand Up @@ -2806,9 +2806,9 @@ namespace rubinius {
Function* func = cast<Function>(
module_->getOrInsertFunction("rbx_check_interrupts", ft));

func->setDoesNotCapture(0, true);
func->setDoesNotCapture(1, true);
func->setDoesNotCapture(2, true);
func->setDoesNotCapture(0);
func->setDoesNotCapture(1);
func->setDoesNotCapture(2);

flush();

Expand Down
10 changes: 8 additions & 2 deletions vm/llvm/state.cpp
Expand Up @@ -10,8 +10,6 @@
#include "llvm/disassembler.hpp"
#include "llvm/jit_context.hpp"

#include "vm/config.h"

#include "builtin/fixnum.hpp"
#include "builtin/constantscope.hpp"
#include "builtin/module.hpp"
Expand All @@ -28,7 +26,11 @@
#include "configuration.hpp"
#include "instruments/timing.hpp"

#if RBX_LLVM_API_VER >= 302
#include <llvm/DataLayout.h>
#else
#include <llvm/Target/TargetData.h>
#endif
// #include <llvm/LinkAllPasses.h>
#include <llvm/Analysis/Verifier.h>
#include <llvm/Transforms/Scalar.h>
Expand Down Expand Up @@ -524,7 +526,11 @@ namespace rubinius {

passes_ = new llvm::FunctionPassManager(module_);

#if RBX_LLVM_API_VER >= 302
passes_->add(new llvm::DataLayout(*engine_->getDataLayout()));
#else
passes_->add(new llvm::TargetData(*engine_->getTargetData()));
#endif

if(fast_code_passes) {
add_fast_passes(passes_);
Expand Down
8 changes: 7 additions & 1 deletion vm/llvm/state.hpp
Expand Up @@ -4,12 +4,18 @@
#include <stdint.h>
#include <unistd.h>

#include "vm/config.h"

#include <llvm/Module.h>
#include <llvm/DerivedTypes.h>
#include <llvm/Function.h>
#include <llvm/Module.h>
#include <llvm/Instructions.h>
#if RBX_LLVM_API_VER >= 302
#include <llvm/IRBuilder.h>
#else
#include <llvm/Support/IRBuilder.h>
#endif
#include <llvm/ExecutionEngine/JIT.h>
#include <llvm/CodeGen/MachineCodeInfo.h>
#include <llvm/Pass.h>
Expand Down Expand Up @@ -301,7 +307,7 @@ namespace rubinius {
}

void setDoesNotCapture(const char* name, int which) {
function(name)->setDoesNotCapture(which, true);
function(name)->setDoesNotCapture(which);
}

llvm::CallInst* call(const char* name, llvm::Value** start, int size,
Expand Down

0 comments on commit d67a3b0

Please sign in to comment.