Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update Rubinius to LLVM 3.0

  • Loading branch information...
commit 420c7557c02f07213d554396c41473ad9227864b 1 parent 46dae28
@dbussink dbussink authored evanphx committed
View
18 configure
@@ -65,11 +65,11 @@ class Configure
@llvm_prebuilt_name = nil
@llvm_system_name = get_system_name
- @llvm_version = "2.8"
- @llvm_api_version = 208
- @llvm_source = "llvm-2.8.tgz"
- @llvm_source_dir = "llvm-2.8"
- @llvm_source_url = "http://llvm.org/releases/2.8/llvm-2.8.tgz"
+ @llvm_version = "3.0"
+ @llvm_api_version = 300
+ @llvm_source = "llvm-3.0.tgz"
+ @llvm_source_dir = "llvm-3.0.src"
+ @llvm_source_url = "http://llvm.org/releases/3.0/llvm-3.0.tar.gz"
@llvm_asset_path = "http://asset.rubini.us/prebuilt"
@@ -611,7 +611,7 @@ Unsupported language version requested: #{ver}. Options are #{@supported_version
@log.print " Checking for existing LLVM library tree: "
if File.directory?("#{@llvm_default}/Release")
version = `#{@perl} #{@llvm_default}/Release/bin/llvm-config --version`.strip
- if version == "2.8"
+ if version == "3.0"
# See if this has rtti turned off and reject it.
if `#{@perl} #{@llvm_default}/Release/bin/llvm-config --cxxflags`.index("-fno-rtti")
@log.write "incorrectly configure (rtti is off)"
@@ -670,10 +670,10 @@ Unsupported language version requested: #{ver}. Options are #{@supported_version
api_version = ("%d%02d" % parts[0..1]).to_i
if `#{@perl} #{config} --cxxflags`.index("-fno-rtti")
@log.write "incorrectly configured llvm (rtti is off)"
- elsif api_version != 208 and api_version != 209
- @log.write "only LLVM 2.8 and 2.9 are supported"
+ elsif api_version != 300
+ @log.write "only LLVM 3.0 is supported"
else
- @log.write "found! (version #{version})"
+ @log.write "found! (version #{version} - api: #{api_version})"
@llvm_configure = config
@llvm = :config
@llvm_api_version = api_version
View
2  rakelib/build.rb
@@ -63,5 +63,5 @@ def gcc_major_version
def llvm_config_flags
"--build=#{host_triple} --host=#{host_triple} " \
- "--enable-optimized --enable-targets=host-only"
+ "--enable-optimized --enable-targets=host,cpp"
end
View
14 rakelib/jit.rake
@@ -28,10 +28,12 @@ namespace :jit do
rubinius::Numeric
rubinius::Float
rubinius::jit::RuntimeData
+ rubinius::jit::GCLiteral
rubinius::CallUnit
rubinius::MethodCacheEntry
- memory::Address
- jit_state!
+ rubinius::RefCount
+ atomic::integer
+ memory::Address!
require 'tempfile'
files = %w!vm/call_frame.hpp
@@ -73,18 +75,18 @@ namespace :jit do
end
end
- opaque = %w!VM TypeInfo VMMethod Fixnum Symbol Selector LookupTable MethodTable
+ opaque = %w!VM State TypeInfo VMMethod Fixnum Symbol Selector LookupTable MethodTable
jit::RuntimeDataHolder Inliners!
File.open("vm/gen/types.ll","w+") do |f|
opaque.each do |o|
- f.puts "%\"struct.rubinius::#{o}\" = type opaque"
+ f.puts "%\"struct.rubinius::#{o}\" = type {}"
end
f.puts(*types)
end
- `vendor/llvm/Release/bin/llvm-as < vm/gen/types.ll > vm/gen/types.bc`
- `vendor/llvm/Release/bin/llc -march=cpp -cppgen=contents -o vm/llvm/types.cpp.gen vm/gen/types.bc`
+ `llvm-as < vm/gen/types.ll > vm/gen/types.bc`
+ `llc -march=cpp -cppgen=contents -o vm/llvm/types.cpp.gen vm/gen/types.bc`
end
task :generate_header do
View
1  vm/llvm/autotypes.cpp
@@ -7,7 +7,6 @@
#include <llvm/CallingConv.h>
#include <llvm/Support/CFG.h>
#include <llvm/Analysis/Passes.h>
-#include <llvm/Target/TargetSelect.h>
#include <llvm/Target/TargetOptions.h>
#include <llvm/Module.h>
View
30 vm/llvm/disassembler.cpp
@@ -2,16 +2,14 @@
#include "vm/config.h"
#include "llvm/disassembler.hpp"
-#if RBX_LLVM_API_VER == 208
-#include <llvm/System/Host.h>
-#elif RBX_LLVM_API_VER == 209
#include <llvm/Support/Host.h>
-#endif
#include <llvm/Instructions.h>
-#include <llvm/Target/TargetRegistry.h>
-#include <llvm/Target/TargetSelect.h>
+#include <llvm/Support/TargetSelect.h>
+#include <llvm/Support/TargetRegistry.h>
+#include <llvm/Target/TargetMachine.h>
#include <llvm/Target/TargetInstrInfo.h>
-#include <llvm/Target/TargetInstrDesc.h>
+#include <llvm/MC/MCDisassembler.h>
+#include <llvm/MC/MCSubtargetInfo.h>
#include <llvm/MC/MCInstPrinter.h>
#include <llvm/MC/MCAsmInfo.h>
#include <llvm/MC/MCInst.h>
@@ -33,10 +31,12 @@ namespace rubinius {
llvm::InitializeNativeTargetAsmPrinter();
llvm::InitializeAllDisassemblers();
target = llvm::TargetRegistry::lookupTarget(host, error);
- target_machine = target->createTargetMachine(host, error);
- asm_info = target_machine->getMCAsmInfo();
+ target_machine = target->createTargetMachine(host, llvm::sys::getHostCPUName(), "");
+
+ sub_target = target->createMCSubtargetInfo(host, llvm::sys::getHostCPUName(), "");
+ asm_info = target->createMCAsmInfo(host);
if(asm_info) {
- disassembler = target->createMCDisassembler();
+ disassembler = target->createMCDisassembler(*sub_target);
memory_object = new JITMemoryObject((const uint8_t*)buffer, (uint64_t) size);
}
}
@@ -44,6 +44,7 @@ namespace rubinius {
JITDisassembler::~JITDisassembler() {
if(memory_object) delete memory_object;
if(disassembler) delete disassembler;
+ if(sub_target) delete sub_target;
if(target_machine) delete target_machine;
}
@@ -56,7 +57,8 @@ namespace rubinius {
return std::string("Can't create assembly information for target");
}
- llvm::MCInstPrinter* printer = target->createMCInstPrinter(asm_info->getAssemblerDialect(), *asm_info);
+ llvm::MCInstPrinter* printer = target->createMCInstPrinter(
+ asm_info->getAssemblerDialect(), *asm_info, *sub_target);
if(!printer) {
return std::string("No instruction printer for target");
}
@@ -75,13 +77,13 @@ namespace rubinius {
uint64_t instruction_position = instruction_offset + instruction_pointer;
if(disassembler->getInstruction(instruction, instruction_size,
*memory_object, instruction_pointer,
- llvm::nulls())) {
- printer->printInst(&instruction, out);
+ llvm::nulls(), llvm::nulls())) {
+ printer->printInst(&instruction, out, "");
output << "0x" << instruction_position << " ";
output << std::setw(30) << std::left << out.str();
- const llvm::TargetInstrDesc &inst_descr = inst_info->get(instruction.getOpcode());
+ const llvm::MCInstrDesc &inst_descr = inst_info->get(instruction.getOpcode());
for(uint8_t i = 0; i < instruction.getNumOperands(); ++i) {
llvm::MCOperand& op = instruction.getOperand(i);
View
4 vm/llvm/disassembler.hpp
@@ -5,8 +5,7 @@
#include <string.h>
#include <iostream>
-#include <llvm/Target/TargetRegistry.h>
-#include <llvm/Target/TargetMachine.h>
+#include <llvm/Support/TargetRegistry.h>
#include <llvm/MC/MCAsmInfo.h>
#include <llvm/MC/MCDisassembler.h>
#include <llvm/Support/MemoryObject.h>
@@ -74,6 +73,7 @@ namespace rubinius {
const llvm::Target* target;
const llvm::TargetMachine* target_machine;
+ const llvm::MCSubtargetInfo* sub_target;
const llvm::MCAsmInfo* asm_info;
llvm::MCDisassembler* disassembler;
const JITMemoryObject* memory_object;
View
23 vm/llvm/inline.cpp
@@ -140,14 +140,14 @@ namespace rubinius {
check_recv(klass);
ops_.setup_out_args(count_);
- std::vector<const Type*> ftypes;
+ std::vector<Type*> ftypes;
ftypes.push_back(ops_.state()->ptr_type("VM"));
ftypes.push_back(ops_.state()->ptr_type("CallFrame"));
ftypes.push_back(ops_.state()->ptr_type("Executable"));
ftypes.push_back(ops_.state()->ptr_type("Module"));
ftypes.push_back(ops_.state()->ptr_type("Arguments"));
- const Type *ft = llvm::PointerType::getUnqual(FunctionType::get(ops_.state()->ptr_type("Object"), ftypes, false));
+ Type *ft = llvm::PointerType::getUnqual(FunctionType::get(ops_.state()->ptr_type("Object"), ftypes, false));
// We can't extract and use a specialized version of cm because we don't
// yet have the ability to check if the specialized version has been
@@ -184,7 +184,7 @@ namespace rubinius {
ops_.out_args()
};
- Value* dc_res = ops_.b().CreateCall(func, call_args, call_args+5, "dc_res");
+ Value* dc_res = ops_.b().CreateCall(func, call_args, "dc_res");
set_result(dc_res);
goto remember;
@@ -658,7 +658,7 @@ namespace rubinius {
context_.leave_inline();
}
- const Type* find_type(JITOperations& ops_, size_t type) {
+ Type* find_type(JITOperations& ops_, size_t type) {
switch(type) {
case RBX_FFI_TYPE_CHAR:
case RBX_FFI_TYPE_UCHAR:
@@ -709,9 +709,9 @@ namespace rubinius {
///
std::vector<Value*> ffi_args;
- std::vector<const Type*> ffi_type;
+ std::vector<Type*> ffi_type;
- std::vector<const Type*> struct_types;
+ std::vector<Type*> struct_types;
struct_types.push_back(ops_.state()->Int32Ty);
struct_types.push_back(ops_.state()->Int1Ty);
@@ -736,7 +736,7 @@ namespace rubinius {
Value* val = sig.call("rbx_ffi_to_int", call_args, 3, "to_int",
ops_.b());
- const Type* type = find_type(ops_, nf->ffi_data->arg_types[i]);
+ Type* type = find_type(ops_, nf->ffi_data->arg_types[i]);
ffi_type.push_back(type);
if(type != ops_.NativeIntTy) {
@@ -829,7 +829,7 @@ namespace rubinius {
break;
case RBX_FFI_TYPE_PTR: {
- const Type* type = llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
+ Type* type = llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
Signature sig(ops_.state(), type);
sig << "VM";
@@ -852,7 +852,7 @@ namespace rubinius {
}
case RBX_FFI_TYPE_STRING: {
- const Type* type = llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
+ Type* type = llvm::PointerType::getUnqual(ops_.state()->Int8Ty);
Signature sig(ops_.state(), type);
sig << "VM";
@@ -886,15 +886,14 @@ namespace rubinius {
Value* check_args[] = { ops_.vm(), ops_.call_frame() };
check.call("rbx_enter_unmanaged", check_args, 2, "unused", ops_.b());
- const Type* return_type = find_type(ops_, nf->ffi_data->ret_type);
+ Type* return_type = find_type(ops_, nf->ffi_data->ret_type);
FunctionType* ft = FunctionType::get(return_type, ffi_type, false);
Value* ep_ptr = ops_.b().CreateIntToPtr(
ConstantInt::get(ops_.state()->IntPtrTy, (intptr_t)nf->ffi_data->ep),
llvm::PointerType::getUnqual(ft), "cast_to_function");
- Value* ffi_result = ops_.b().CreateCall(ep_ptr, ffi_args.begin(),
- ffi_args.end(), "ffi_result");
+ Value* ffi_result = ops_.b().CreateCall(ep_ptr, ffi_args, "ffi_result");
check.call("rbx_exit_unmanaged", check_args, 2, "unused", ops_.b());
View
4 vm/llvm/inline_primitive.cpp
@@ -456,7 +456,7 @@ namespace rubinius {
perform->moveAfter(convert_block);
ops.set_block(perform);
- PHINode* rhs = ops.b().CreatePHI(fix_rhs->getType(), "rhs");
+ PHINode* rhs = ops.b().CreatePHI(fix_rhs->getType(), 2, "rhs");
rhs->addIncoming(unboxed_rhs, unbox_block);
rhs->addIncoming(fix_rhs, convert_block);
@@ -544,7 +544,7 @@ namespace rubinius {
do_compare->moveAfter(converted_block);
- PHINode* rhs = ops.b().CreatePHI(converted_rhs->getType(), "float_rhs");
+ PHINode* rhs = ops.b().CreatePHI(converted_rhs->getType(), 2, "float_rhs");
rhs->addIncoming(unboxed_rhs, unboxed_block);
rhs->addIncoming(converted_rhs, converted_block);
View
18 vm/llvm/jit_block.cpp
@@ -17,7 +17,7 @@ namespace rubinius {
namespace jit {
void BlockBuilder::setup() {
- std::vector<const Type*> ftypes;
+ std::vector<Type*> ftypes;
ftypes.push_back(ls_->ptr_type("VM"));
ftypes.push_back(ls_->ptr_type("CallFrame"));
ftypes.push_back(ls_->ptr_type("BlockEnvironment"));
@@ -115,7 +115,7 @@ namespace jit {
"invocation.module");
Value* creation_mod = b().CreateLoad(
- get_field(block_env, offset::blockenv_module),
+ get_field(block_env, offset::BlockEnvironment::module),
"env.module");
Value* mod = b().CreateSelect(
@@ -136,7 +136,7 @@ namespace jit {
// the scope the block was created in, not the top scope for depth
// variables to work.
Value* be_scope = b().CreateLoad(
- get_field(block_env, offset::blockenv_scope),
+ get_field(block_env, offset::BlockEnvironment::scope),
"env.scope");
b().CreateStore(be_scope, get_field(vars, offset::vars_parent));
@@ -148,7 +148,7 @@ namespace jit {
void BlockBuilder::initialize_frame(int stack_size) {
Value* cm_gep = get_field(call_frame, offset::CallFrame::cm);
- method = b().CreateLoad(get_field(block_env, offset::blockenv_code),
+ method = b().CreateLoad(get_field(block_env, offset::BlockEnvironment::code),
"env.code");
// previous
@@ -195,7 +195,7 @@ namespace jit {
// top_scope
top_scope = b().CreateLoad(
- get_field(block_env, offset::blockenv_top_scope),
+ get_field(block_env, offset::BlockEnvironment::top_scope),
"env.top_scope");
b().CreateStore(top_scope, get_field(call_frame, offset::CallFrame::top_scope));
@@ -316,7 +316,7 @@ namespace jit {
b().CreateStore(
b().CreateLoad(
b().CreateGEP(arg_ary, loop_val)),
- b().CreateGEP(vars, idx2, idx2+3));
+ b().CreateGEP(vars, idx2));
// *loop_i = loop_val + 1
b().CreateStore(
@@ -375,7 +375,7 @@ namespace jit {
b().CreateStore(
b().CreateLoad(
b().CreateGEP(arg_ary, loop_val)),
- b().CreateGEP(vars, idx2, idx2+3));
+ b().CreateGEP(vars, idx2));
// *loop_i = loop_val + 1
b().CreateStore(
@@ -432,7 +432,7 @@ namespace jit {
b().CreateStore(
b().CreateLoad(
b().CreateGEP(arg_ary, loop_val)),
- b().CreateGEP(vars, idx2, idx2+3));
+ b().CreateGEP(vars, idx2));
// *loop_i = loop_val + 1
b().CreateStore(
@@ -474,7 +474,7 @@ namespace jit {
cint(vmm_->splat_position)
};
- Value* pos = b().CreateGEP(vars, idx3, idx3+3, "splat_pos");
+ Value* pos = b().CreateGEP(vars, idx3, "splat_pos");
b().CreateStore(splat_val, pos);
}
}
View
6 vm/llvm/jit_builder.cpp
@@ -86,7 +86,7 @@ namespace jit {
cint(i)
};
- Value* gep = b().CreateGEP(vars, idx, idx+3, "local_pos");
+ Value* gep = b().CreateGEP(vars, idx, "local_pos");
b().CreateStore(nil, gep);
}
return;
@@ -111,7 +111,7 @@ namespace jit {
cur
};
- Value* gep = b().CreateGEP(vars, idx, idx+3, "local_pos");
+ Value* gep = b().CreateGEP(vars, idx, "local_pos");
b().CreateStore(nil, gep);
Value* added = b().CreateAdd(cur, one, "added");
@@ -164,7 +164,7 @@ namespace jit {
};
Value* self_class = b().CreateLoad(
- b().CreateGEP(self, class_idx, class_idx+3),
+ b().CreateGEP(self, class_idx),
"class");
Value* runtime_id = b().CreateLoad(
View
12 vm/llvm/jit_builder.hpp
@@ -19,11 +19,11 @@ namespace jit {
public:
LLVMState* ls_;
VMMethod* vmm_;
- const llvm::Type* cf_type;
- const llvm::Type* vars_type;
- const llvm::Type* stack_vars_type;
- const llvm::Type* obj_type;
- const llvm::Type* obj_ary_type;
+ llvm::Type* cf_type;
+ llvm::Type* vars_type;
+ llvm::Type* stack_vars_type;
+ llvm::Type* obj_type;
+ llvm::Type* obj_ary_type;
llvm::Value* block_env;
llvm::Value* block_inv;
@@ -84,7 +84,7 @@ namespace jit {
llvm::Value* get_field(llvm::Value* val, int which);
template <typename T>
- llvm::Value* constant(T obj, const llvm::Type* obj_type) {
+ llvm::Value* constant(T obj, llvm::Type* obj_type) {
return b().CreateIntToPtr(
llvm::ConstantInt::get(ls_->Int64Ty, (intptr_t)obj),
obj_type, "constant");
View
1  vm/llvm/jit_compiler.cpp
@@ -21,7 +21,6 @@
#include <llvm/CallingConv.h>
#include <llvm/Support/CFG.h>
#include <llvm/Analysis/Passes.h>
-#include <llvm/Target/TargetSelect.h>
#include <llvm/Target/TargetOptions.h>
View
2  vm/llvm/jit_inline_block.cpp
@@ -128,7 +128,7 @@ namespace jit {
int_pos
};
- Value* pos = b().CreateGEP(vars, idx2, idx2+3, "local_pos");
+ Value* pos = b().CreateGEP(vars, idx2, "local_pos");
b().CreateStore(stack_args.at(i), pos);
}
View
2  vm/llvm/jit_inline_method.cpp
@@ -111,7 +111,7 @@ namespace jit {
int_pos
};
- Value* pos = b().CreateGEP(vars, idx2, idx2+3, "local_pos");
+ Value* pos = b().CreateGEP(vars, idx2, "local_pos");
Value* arg_val = stack_args.at(i);
View
16 vm/llvm/jit_method.cpp
@@ -19,7 +19,7 @@ namespace rubinius {
namespace jit {
void MethodBuilder::setup() {
- std::vector<const Type*> ftypes;
+ std::vector<Type*> ftypes;
ftypes.push_back(ls_->ptr_type("VM"));
ftypes.push_back(ls_->ptr_type("CallFrame"));
ftypes.push_back(ls_->ptr_type("Executable"));
@@ -108,7 +108,7 @@ namespace jit {
int_pos
};
- Value* pos = b().CreateGEP(vars, idx2, idx2+3, "var_pos");
+ Value* pos = b().CreateGEP(vars, idx2, "var_pos");
b().CreateStore(arg_val, pos);
}
@@ -158,7 +158,7 @@ namespace jit {
b().CreateStore(
b().CreateLoad(
b().CreateGEP(arg_ary, loop_val)),
- b().CreateGEP(vars, idx2, idx2+3));
+ b().CreateGEP(vars, idx2));
// *loop_i = loop_val + 1
b().CreateStore(
@@ -220,7 +220,7 @@ namespace jit {
b().CreateStore(
b().CreateLoad(
b().CreateGEP(arg_ary, loop_val)),
- b().CreateGEP(vars, idx2, idx2+3));
+ b().CreateGEP(vars, idx2));
// *loop_i = loop_val + 1
b().CreateStore(
@@ -262,7 +262,7 @@ namespace jit {
cint(vmm_->splat_position)
};
- Value* pos = b().CreateGEP(vars, idx3, idx3+3, "splat_pos");
+ Value* pos = b().CreateGEP(vars, idx3, "splat_pos");
b().CreateStore(splat_val, pos);
}
}
@@ -295,7 +295,7 @@ namespace jit {
int_pos
};
- Value* pos = b().CreateGEP(vars, idx2, idx2+3, "var_pos");
+ Value* pos = b().CreateGEP(vars, idx2, "var_pos");
b().CreateStore(arg_val, pos);
}
@@ -351,7 +351,7 @@ namespace jit {
loop_val
};
- Value* pos = b().CreateGEP(vars, idx2, idx2+3, "var_pos");
+ Value* pos = b().CreateGEP(vars, idx2, "var_pos");
b().CreateStore(arg_val, pos);
@@ -394,7 +394,7 @@ namespace jit {
cint(vmm_->splat_position)
};
- Value* pos = b().CreateGEP(vars, idx3, idx3+3, "splat_pos");
+ Value* pos = b().CreateGEP(vars, idx3, "splat_pos");
b().CreateStore(splat_val, pos);
}
}
View
26 vm/llvm/jit_operations.hpp
@@ -86,14 +86,14 @@ namespace rubinius {
llvm::Value* valid_flag_;
public:
- const llvm::Type* NativeIntTy;
- const llvm::Type* FixnumTy;
- const llvm::Type* ObjType;
- const llvm::Type* ObjArrayTy;
+ llvm::Type* NativeIntTy;
+ llvm::Type* FixnumTy;
+ llvm::Type* ObjType;
+ llvm::Type* ObjArrayTy;
// Frequently used types
- const llvm::Type* VMTy;
- const llvm::Type* CallFrameTy;
+ llvm::Type* VMTy;
+ llvm::Type* CallFrameTy;
// Commonly used constants
llvm::Value* Zero;
@@ -256,13 +256,13 @@ namespace rubinius {
// Type resolution and manipulation
//
- const llvm::Type* ptr_type(std::string name) {
+ llvm::Type* ptr_type(std::string name) {
std::string full_name = std::string("struct.rubinius::") + name;
return llvm::PointerType::getUnqual(
module_->getTypeByName(full_name.c_str()));
}
- const llvm::Type* type(std::string name) {
+ llvm::Type* type(std::string name) {
std::string full_name = std::string("struct.rubinius::") + name;
return module_->getTypeByName(full_name.c_str());
}
@@ -272,7 +272,7 @@ namespace rubinius {
}
Value* upcast(Value* rec, const char* name) {
- const Type* type = ptr_type(name);
+ Type* type = ptr_type(name);
return b().CreateBitCast(rec, type, "upcast");
}
@@ -735,7 +735,7 @@ namespace rubinius {
ObjType, "const_obj");
}
- Value* constant(void* obj, const Type* type) {
+ Value* constant(void* obj, Type* type) {
return b().CreateIntToPtr(
ConstantInt::get(ls_->IntPtrTy, (intptr_t)obj),
type, "const_of_type");
@@ -765,7 +765,7 @@ namespace rubinius {
// Fixnum manipulations
//
- Value* tag_strip(Value* obj, const Type* type = NULL) {
+ Value* tag_strip(Value* obj, Type* type = NULL) {
if(!type) type = FixnumTy;
Value* i = b().CreatePtrToInt(
@@ -904,7 +904,7 @@ namespace rubinius {
//
GetElementPtrInst* create_gep(Value* rec, Value** idx, int count,
const char* name) {
- return cast<GetElementPtrInst>(b().CreateGEP(rec, idx, idx+count, name));
+ return cast<GetElementPtrInst>(b().CreateGEP(rec, ArrayRef<Value*>(idx, count), name));
}
LoadInst* create_load(Value* ptr, const char* name = "") {
@@ -976,7 +976,7 @@ namespace rubinius {
sig.call("rbx_jit_debug_spot", call_args, 1, "", b());
}
- Value* gc_literal(Object* obj, const Type* type) {
+ Value* gc_literal(Object* obj, Type* type) {
jit::GCLiteral* lit = method_info_.runtime_data()->new_literal(obj);
Value* ptr = constant(lit->address_of_object(), llvm::PointerType::getUnqual(type));
return b().CreateLoad(ptr, "gc_literal");
View
172 vm/llvm/jit_visit.hpp
@@ -40,13 +40,13 @@ namespace rubinius {
, func_(0)
{}
- void resolve(const char* name, const Type* rt) {
+ void resolve(const char* name, Type* rt) {
ret_type_ = rt;
func_ = function(name);
}
Value* call(Value** start, int size, const char* inst_name, IRBuilder<>& b) {
- return b.CreateCall(func_, start, start+size, inst_name);
+ return b.CreateCall(func_, ArrayRef<Value*>(start, size), inst_name);
}
};
@@ -286,7 +286,7 @@ namespace rubinius {
/////
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "possible_break");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "possible_break");
phi->addIncoming(val, orig);
phi->addIncoming(crv, push_break_val);
@@ -657,7 +657,7 @@ namespace rubinius {
};
Value* execute_pos = b().CreateGEP(cache_const,
- execute_pos_idx, execute_pos_idx+2, "execute_pos");
+ execute_pos_idx, "execute_pos");
Value* execute = b().CreateLoad(execute_pos, "execute");
@@ -669,7 +669,7 @@ namespace rubinius {
};
flush_ip();
- return b().CreateCall(execute, call_args, call_args+4, "ic_send");
+ return b().CreateCall(execute, call_args, "ic_send");
}
Value* inline_cache_send(int args, InlineCache* cache) {
@@ -691,7 +691,7 @@ namespace rubinius {
};
Value* execute_pos = b().CreateGEP(cache_const,
- execute_pos_idx, execute_pos_idx+2, "execute_pos");
+ execute_pos_idx, "execute_pos");
Value* execute = b().CreateLoad(execute_pos, "execute");
@@ -705,7 +705,7 @@ namespace rubinius {
};
flush_ip();
- return b().CreateCall(execute, call_args, call_args+4, "ic_send");
+ return b().CreateCall(execute, call_args, "ic_send");
}
Value* splat_send(Symbol* name, int args, bool priv=false) {
@@ -824,7 +824,7 @@ namespace rubinius {
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "equal_value");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "equal_value");
phi->addIncoming(called_value, send_block);
phi->addIncoming(imm_value, fast);
@@ -861,7 +861,7 @@ namespace rubinius {
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "equal_value");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "equal_value");
phi->addIncoming(called_value, send_block);
phi->addIncoming(imm_value, fast);
@@ -897,7 +897,7 @@ namespace rubinius {
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "addition");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "addition");
phi->addIncoming(called_value, send_bb);
phi->addIncoming(imm_value, fast);
@@ -933,7 +933,7 @@ namespace rubinius {
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "compare");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "compare");
phi->addIncoming(called_value, send_bb);
phi->addIncoming(imm_value, fast);
@@ -961,11 +961,11 @@ namespace rubinius {
set_block(fast);
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(FixnumTy);
types.push_back(FixnumTy);
- std::vector<const Type*> struct_types;
+ std::vector<Type*> struct_types;
struct_types.push_back(FixnumTy);
struct_types.push_back(ls_->Int1Ty);
@@ -978,7 +978,7 @@ namespace rubinius {
Value* recv_int = tag_strip(recv);
Value* arg_int = tag_strip(arg);
Value* call_args[] = { recv_int, arg_int };
- Value* res = b().CreateCall(func, call_args, call_args+2, "add.overflow");
+ Value* res = b().CreateCall(func, call_args, "add.overflow");
Value* sum = b().CreateExtractValue(res, 0, "sum");
Value* dof = b().CreateExtractValue(res, 1, "did_overflow");
@@ -993,7 +993,7 @@ namespace rubinius {
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "addition");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "addition");
phi->addIncoming(called_value, send_bb);
phi->addIncoming(imm_value, tagnow);
@@ -1021,11 +1021,11 @@ namespace rubinius {
set_block(fast);
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(FixnumTy);
types.push_back(FixnumTy);
- std::vector<const Type*> struct_types;
+ std::vector<Type*> struct_types;
struct_types.push_back(FixnumTy);
struct_types.push_back(ls_->Int1Ty);
@@ -1038,7 +1038,7 @@ namespace rubinius {
Value* recv_int = tag_strip(recv);
Value* arg_int = tag_strip(arg);
Value* call_args[] = { recv_int, arg_int };
- Value* res = b().CreateCall(func, call_args, call_args+2, "sub.overflow");
+ Value* res = b().CreateCall(func, call_args, "sub.overflow");
Value* sum = b().CreateExtractValue(res, 0, "sub");
Value* dof = b().CreateExtractValue(res, 1, "did_overflow");
@@ -1054,7 +1054,7 @@ namespace rubinius {
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "subtraction");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "subtraction");
phi->addIncoming(called_value, send_bb);
phi->addIncoming(imm_value, tagnow);
@@ -1079,7 +1079,7 @@ namespace rubinius {
cint(which)
};
- gep = b().CreateGEP(lits, idx2, idx2+3, "literal_pos");
+ gep = b().CreateGEP(lits, idx2, "literal_pos");
return b().CreateLoad(gep, "literal");
}
@@ -1095,7 +1095,7 @@ namespace rubinius {
}
void visit_string_dup() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -1111,7 +1111,7 @@ namespace rubinius {
stack_pop()
};
- Value* dup = b().CreateCall(func, call_args, call_args+3, "string_dup");
+ Value* dup = b().CreateCall(func, call_args, "string_dup");
check_for_exception(dup);
stack_push(dup, type::KnownType::instance(ls_->string_class_id()));
}
@@ -1134,7 +1134,7 @@ namespace rubinius {
cint(which)
};
- return b().CreateGEP(vars, idx2, idx2+3, "local_pos");
+ return b().CreateGEP(vars, idx2, "local_pos");
}
void visit_push_stack_local(opcode which) {
@@ -1154,7 +1154,7 @@ namespace rubinius {
cint(which)
};
- Value* pos = b().CreateGEP(vars_, idx2, idx2+3, "local_pos");
+ Value* pos = b().CreateGEP(vars_, idx2, "local_pos");
if(LocalInfo* bli = current_jbb_->get_local(which)) {
type::KnownType kt = bli->known_type();
@@ -1210,13 +1210,13 @@ namespace rubinius {
cint(which)
};
- Value* pos = b().CreateGEP(vars_, idx2, idx2+3, "local_pos");
+ Value* pos = b().CreateGEP(vars_, idx2, "local_pos");
Value* val;
JITStackArgs* inline_args = incoming_args();
if(inline_args && current_hint() == cHintLazyBlockArgs) {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(ls_->ptr_type("VM"));
types.push_back(ls_->Int32Ty);
@@ -1242,7 +1242,7 @@ namespace rubinius {
}
}
- val = b().CreateCall(func, outgoing_args.begin(), outgoing_args.end(), "ary");
+ val = b().CreateCall(func, outgoing_args, "ary");
} else {
val = stack_top();
}
@@ -1425,7 +1425,7 @@ namespace rubinius {
clong(reinterpret_cast<uintptr_t>(invoker)),
llvm::PointerType::getUnqual(sig.type()));
- Value* call = b().CreateCall(ptr, call_args, call_args + 4, "invoked_prim");
+ Value* call = b().CreateCall(ptr, call_args, "invoked_prim");
stack_remove(args);
check_for_exception(call);
@@ -1437,7 +1437,7 @@ namespace rubinius {
set_block(fin);
- PHINode* phi = b().CreatePHI(ObjType, "object_class");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "object_class");
phi->addIncoming(inline_klass, inline_body);
phi->addIncoming(call, cur);
@@ -1503,7 +1503,7 @@ namespace rubinius {
b().CreateBr(cont);
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "send_result");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "send_result");
phi->addIncoming(inl.result(), inline_block);
phi->addIncoming(send_res, failure);
@@ -1611,7 +1611,7 @@ namespace rubinius {
emit_delayed_create_block();
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
// we use stack_set_top here because we always have a placeholder
@@ -1648,9 +1648,9 @@ namespace rubinius {
}
if(push) {
- stack_push(b().CreateCall(func, call_args.begin(), call_args.end(), "create_block"));
+ stack_push(b().CreateCall(func, call_args, "create_block"));
} else {
- stack_set_top(b().CreateCall(func, call_args.begin(), call_args.end(), "create_block"));
+ stack_set_top(b().CreateCall(func, call_args, "create_block"));
}
return;
};
@@ -1669,9 +1669,9 @@ namespace rubinius {
};
if(push) {
- stack_push(b().CreateCall(func, call_args, call_args+3, "create_block"));
+ stack_push(b().CreateCall(func, call_args, "create_block"));
} else {
- stack_set_top(b().CreateCall(func, call_args, call_args+3, "create_block"));
+ stack_set_top(b().CreateCall(func, call_args, "create_block"));
}
}
@@ -1739,7 +1739,7 @@ namespace rubinius {
BasicBlock* failure = new_block("fallback");
BasicBlock* cont = new_block("continue");
BasicBlock* cleanup = new_block("send_done");
- PHINode* send_result = b().CreatePHI(ObjType, "send_result");
+ PHINode* send_result = b().CreatePHI(ObjType, 1, "send_result");
Inliner inl(context(), *this, cache, args, failure);
@@ -1857,7 +1857,7 @@ namespace rubinius {
}
void visit_cast_array() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -1873,13 +1873,13 @@ namespace rubinius {
stack_pop()
};
- Value* val = b().CreateCall(func, call_args, call_args+3, "cast_array");
+ Value* val = b().CreateCall(func, call_args, "cast_array");
check_for_exception(val);
stack_push(val);
}
void visit_cast_multi_value() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -1895,7 +1895,7 @@ namespace rubinius {
stack_pop()
};
- Value* val = b().CreateCall(func, call_args, call_args+3, "cast_multi_value");
+ Value* val = b().CreateCall(func, call_args, "cast_multi_value");
check_for_exception(val);
stack_push(val);
}
@@ -2019,7 +2019,7 @@ namespace rubinius {
}
void visit_add_scope() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2035,7 +2035,7 @@ namespace rubinius {
stack_pop()
};
- b().CreateCall(func, call_args, call_args+3);
+ b().CreateCall(func, call_args);
}
Object* current_literal(opcode which) {
@@ -2086,7 +2086,7 @@ namespace rubinius {
set_block(use_call);
}
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2109,7 +2109,7 @@ namespace rubinius {
cint(cache)
};
- CallInst* ret = b().CreateCall(func, call_args, call_args+4,
+ CallInst* ret = b().CreateCall(func, call_args,
"push_const_fast");
ret->setOnlyReadsMemory(true);
@@ -2122,7 +2122,7 @@ namespace rubinius {
b().CreateBr(cont);
set_block(cont);
- PHINode* phi = b().CreatePHI(ObjType, "constant");
+ PHINode* phi = b().CreatePHI(ObjType, 2, "constant");
phi->addIncoming(cached_value, cached_block);
phi->addIncoming(ret, ret_block);
@@ -2133,7 +2133,7 @@ namespace rubinius {
}
void visit_push_const(opcode name) {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2151,7 +2151,7 @@ namespace rubinius {
constant(as<Symbol>(literal(name)))
};
- Value* ret = b().CreateCall(func, call_args, call_args+3, "push_const_fast");
+ Value* ret = b().CreateCall(func, call_args, "push_const_fast");
check_for_exception(ret);
stack_push(ret);
}
@@ -2159,7 +2159,7 @@ namespace rubinius {
void visit_set_const(opcode name) {
set_has_side_effects();
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2177,13 +2177,13 @@ namespace rubinius {
stack_top()
};
- b().CreateCall(func, call_args, call_args+4);
+ b().CreateCall(func, call_args);
}
void visit_set_const_at(opcode name) {
set_has_side_effects();
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(ObjType);
@@ -2201,7 +2201,7 @@ namespace rubinius {
val
};
- b().CreateCall(func, call_args, call_args+4);
+ b().CreateCall(func, call_args);
stack_push(val);
}
@@ -2209,7 +2209,7 @@ namespace rubinius {
void visit_set_literal(opcode which) {
set_has_side_effects();
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2227,7 +2227,7 @@ namespace rubinius {
stack_top()
};
- b().CreateCall(func, call_args, call_args+4);
+ b().CreateCall(func, call_args);
}
void visit_push_variables() {
@@ -2284,7 +2284,7 @@ namespace rubinius {
stack_push(inline_args->at(0));
break;
default: {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(ls_->ptr_type("VM"));
types.push_back(ls_->Int32Ty);
@@ -2301,12 +2301,12 @@ namespace rubinius {
}
Value* ary =
- b().CreateCall(func, outgoing_args.begin(), outgoing_args.end(), "ary");
+ b().CreateCall(func, outgoing_args, "ary");
stack_push(ary);
}
}
} else {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(ptr_type("Arguments"));
@@ -2320,7 +2320,7 @@ namespace rubinius {
args_
};
- stack_push(b().CreateCall(func, call_args, call_args+2, "cfsba"));
+ stack_push(b().CreateCall(func, call_args, "cfsba"));
}
}
@@ -2328,7 +2328,7 @@ namespace rubinius {
JITStackArgs* inline_args = incoming_args();
if(inline_args) {
if(inline_args->size() == 1) {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(ls_->ptr_type("VM"));
types.push_back(CallFrameTy);
types.push_back(ls_->Int32Ty);
@@ -2347,7 +2347,7 @@ namespace rubinius {
}
Value* ary =
- b().CreateCall(func, outgoing_args.begin(), outgoing_args.end(), "ary");
+ b().CreateCall(func, outgoing_args, "ary");
check_for_exception(ary);
stack_push(ary);
} else {
@@ -2379,7 +2379,7 @@ namespace rubinius {
// If the arguments came from an unboxed array, we have to put them
// back in the array before splatting them.
if(inline_args->from_unboxed_array()) {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(ls_->ptr_type("VM"));
types.push_back(ls_->Int32Ty);
@@ -2396,7 +2396,7 @@ namespace rubinius {
}
Value* ary =
- b().CreateCall(func, outgoing_args.begin(), outgoing_args.end(), "ary");
+ b().CreateCall(func, outgoing_args, "ary");
Value* outargs2[] = {
vm(),
@@ -2404,10 +2404,10 @@ namespace rubinius {
ary
};
- Value* wrapped = b().CreateCall(func, outargs2, outargs2 + 3, "splat_ary");
+ Value* wrapped = b().CreateCall(func, outargs2, "splat_ary");
stack_push(wrapped);
} else {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(ls_->ptr_type("VM"));
types.push_back(CallFrameTy);
types.push_back(ls_->Int32Ty);
@@ -2426,7 +2426,7 @@ namespace rubinius {
}
Value* ary =
- b().CreateCall(func, outgoing_args.begin(), outgoing_args.end(), "ary");
+ b().CreateCall(func, outgoing_args, "ary");
check_for_exception(ary);
stack_push(ary);
}
@@ -2479,7 +2479,7 @@ namespace rubinius {
};
Value* varscope = b().CreateLoad(
- b().CreateGEP(vars_, idx, idx+2), "scope.parent");
+ b().CreateGEP(vars_, idx), "scope.parent");
*/
Signature sig(ls_, ObjType);
@@ -2514,7 +2514,7 @@ namespace rubinius {
cint(offset::vars_parent)
};
- Value* gep = b().CreateGEP(vars_, idx, idx+2, "parent_pos");
+ Value* gep = b().CreateGEP(vars_, idx, "parent_pos");
Value* parent = b().CreateLoad(gep, "scope.parent");
set_scope_local(parent, index);
@@ -2524,7 +2524,7 @@ namespace rubinius {
// Handle depth > 1
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2544,7 +2544,7 @@ namespace rubinius {
cint(index)
};
- Value* val = b().CreateCall(func, call_args, call_args+5, "sld");
+ Value* val = b().CreateCall(func, call_args, "sld");
check_for_exception(val);
stack_push(val);
}
@@ -2591,7 +2591,7 @@ namespace rubinius {
};
Value* varscope = b().CreateLoad(
- b().CreateGEP(vars_, idx, idx+2), "scope.parent");
+ b().CreateGEP(vars_, idx), "scope.parent");
*/
Signature sig(ls_, ObjType);
@@ -2628,7 +2628,7 @@ namespace rubinius {
cint(offset::vars_parent)
};
- Value* gep = b().CreateGEP(vars_, idx, idx+2, "parent_pos");
+ Value* gep = b().CreateGEP(vars_, idx, "parent_pos");
Value* parent = b().CreateLoad(gep, "scope.parent");
push_scope_local(parent, index);
@@ -2637,7 +2637,7 @@ namespace rubinius {
*/
// Handle depth > 1
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2655,7 +2655,7 @@ namespace rubinius {
cint(index)
};
- Value* val = b().CreateCall(func, call_args, call_args+4, "pld");
+ Value* val = b().CreateCall(func, call_args, "pld");
check_for_exception(val);
stack_push(val);
}
@@ -2817,7 +2817,7 @@ namespace rubinius {
}
void visit_check_interrupts() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -2837,7 +2837,7 @@ namespace rubinius {
call_frame_
};
- Value* ret = b().CreateCall(func, call_args, call_args+2, "ci");
+ Value* ret = b().CreateCall(func, call_args, "ci");
check_for_exception(ret, false);
}
@@ -2902,7 +2902,7 @@ namespace rubinius {
cint(offset::vars_self)
};
- Value* pos = b().CreateGEP(vars_, idx, idx+2, "self_pos");
+ Value* pos = b().CreateGEP(vars_, idx, "self_pos");
Value* self = b().CreateLoad(pos, "self");
@@ -2916,7 +2916,7 @@ namespace rubinius {
cint(i / sizeof(Object*))
};
- pos = b().CreateGEP(cst, idx2, idx2+1, "field_pos");
+ pos = b().CreateGEP(cst, idx2, "field_pos");
stack_push(b().CreateLoad(pos, "field"));
}
@@ -2936,7 +2936,7 @@ namespace rubinius {
code = new_block("is_exception");
set_block(code);
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
FunctionType* ft = FunctionType::get(ls_->Int1Ty, types, false);
@@ -2944,7 +2944,7 @@ namespace rubinius {
module_->getOrInsertFunction("rbx_raising_exception", ft));
Value* call_args[] = { vm_ };
- Value* isit = b().CreateCall(func, call_args, call_args+1, "rae");
+ Value* isit = b().CreateCall(func, call_args, "rae");
// Chain to an existing handler.
BasicBlock* next = 0;
@@ -3070,7 +3070,7 @@ namespace rubinius {
}
void visit_push_current_exception() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
@@ -3080,13 +3080,13 @@ namespace rubinius {
Value* call_args[] = { vm_ };
- stack_push(b().CreateCall(func, call_args, call_args+1, "ce"));
+ stack_push(b().CreateCall(func, call_args, "ce"));
}
void visit_clear_exception() {
set_has_side_effects();
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
@@ -3096,11 +3096,11 @@ namespace rubinius {
Value* call_args[] = { vm_ };
- b().CreateCall(func, call_args, call_args+1);
+ b().CreateCall(func, call_args);
}
void visit_push_exception_state() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
@@ -3110,11 +3110,11 @@ namespace rubinius {
Value* call_args[] = { vm_ };
- stack_push(b().CreateCall(func, call_args, call_args+1));
+ stack_push(b().CreateCall(func, call_args));
}
void visit_restore_exception_state() {
- std::vector<const Type*> types;
+ std::vector<Type*> types;
types.push_back(VMTy);
types.push_back(CallFrameTy);
@@ -3126,7 +3126,7 @@ namespace rubinius {
Value* call_args[] = { vm_, call_frame_, stack_pop() };
- b().CreateCall(func, call_args, call_args+3);
+ b().CreateCall(func, call_args);
}
void visit_find_const(opcode which) {
View
4 vm/llvm/method_info.cpp
@@ -10,7 +10,7 @@
#include "object_utils.hpp"
namespace rubinius {
- llvm::AllocaInst* JITMethodInfo::create_alloca(const llvm::Type* type, llvm::Value* size,
+ llvm::AllocaInst* JITMethodInfo::create_alloca(llvm::Type* type, llvm::Value* size,
const llvm::Twine& name)
{
return new llvm::AllocaInst(type, size, name,
@@ -54,7 +54,7 @@ namespace rubinius {
void JITMethodInfo::setup_return() {
return_pad_ = llvm::BasicBlock::Create(context_.state()->ctx(), "return_pad", function());
return_phi_ = llvm::PHINode::Create(
- context_.state()->ptr_type("Object"), "return_phi", return_pad_);
+ context_.state()->ptr_type("Object"), 0, "return_phi", return_pad_);
}
llvm::BasicBlock* JITMethodInfo::new_block(const char* name) {
View
2  vm/llvm/method_info.hpp
@@ -268,7 +268,7 @@ namespace rubinius {
void setup_return();
- llvm::AllocaInst* create_alloca(const llvm::Type* type, llvm::Value* size = 0,
+ llvm::AllocaInst* create_alloca(llvm::Type* type, llvm::Value* size = 0,
const llvm::Twine& name = "");
llvm::BasicBlock* new_block(const char* name);
View
7 vm/llvm/offset.hpp
@@ -42,13 +42,6 @@ namespace offset {
const static int blockinv_static_scope = 2;
const static int blockinv_module = 3;
- const static int blockenv_scope = 1;
- const static int blockenv_top_scope = 2;
- const static int blockenv_code = 3;
- const static int blockenv_module = 4;
- const static int blockenv_vmm = 5;
- const static int blockenv_execute = 6;
-
const static int runtime_data_method = 0;
const static int runtime_data_name = 1;
const static int runtime_data_module = 2;
View
5 vm/llvm/offset_specific.hpp
@@ -115,9 +115,8 @@ namespace BlockEnvironment {
const static int header = 0;
const static int scope = 1;
const static int top_scope = 2;
- const static int local_count = 3;
- const static int method = 4;
- const static int module = 5;
+ const static int code = 3;
+ const static int module = 4;
}
namespace Dispatch {
const static int name = 0;
View
10 vm/llvm/passes.cpp
@@ -22,7 +22,7 @@ namespace {
using namespace llvm;
class GuardEliminator : public FunctionPass {
- const Type* float_type_;
+ Type* float_type_;
public:
static char ID;
@@ -301,10 +301,10 @@ namespace {
class RubiniusAliasAnalysis : public FunctionPass, public AliasAnalysis {
- const Type* class_type_;
- const Type* object_type_;
- const Type* args_type_;
- const Type* float_type_;
+ Type* class_type_;
+ Type* object_type_;
+ Type* args_type_;
+ Type* float_type_;
public:
static char ID;
View
6 vm/llvm/state.cpp
@@ -34,7 +34,7 @@
#include <llvm/CallingConv.h>
#include <llvm/Support/CFG.h>
#include <llvm/Analysis/Passes.h>
-#include <llvm/Target/TargetSelect.h>
+#include <llvm/Support/TargetSelect.h>
#include <llvm/Target/TargetOptions.h>
@@ -125,13 +125,13 @@ namespace rubinius {
state->shared().llvm_state->unpause_i();
}
- const llvm::Type* LLVMState::ptr_type(std::string name) {
+ llvm::Type* LLVMState::ptr_type(std::string name) {
std::string full_name = std::string("struct.rubinius::") + name;
return llvm::PointerType::getUnqual(
module_->getTypeByName(full_name.c_str()));
}
- const llvm::Type* LLVMState::type(std::string name) {
+ llvm::Type* LLVMState::type(std::string name) {
std::string full_name = std::string("struct.rubinius::") + name;
return module_->getTypeByName(full_name.c_str());
}
View
46 vm/llvm/state.hpp
@@ -50,7 +50,7 @@ namespace rubinius {
llvm::ExecutionEngine* engine_;
llvm::FunctionPassManager* passes_;
- const llvm::Type* object_;
+ llvm::Type* object_;
Configuration& config_;
BackgroundCompilerThread* background_thread_;
@@ -84,20 +84,20 @@ namespace rubinius {
uint64_t time_spent;
- const llvm::Type* VoidTy;
+ llvm::Type* VoidTy;
- const llvm::Type* Int1Ty;
- const llvm::Type* Int8Ty;
- const llvm::Type* Int16Ty;
- const llvm::Type* Int32Ty;
- const llvm::Type* Int64Ty;
- const llvm::Type* IntPtrTy;
- const llvm::Type* VoidPtrTy;
+ llvm::Type* Int1Ty;
+ llvm::Type* Int8Ty;
+ llvm::Type* Int16Ty;
+ llvm::Type* Int32Ty;
+ llvm::Type* Int64Ty;
+ llvm::Type* IntPtrTy;
+ llvm::Type* VoidPtrTy;
- const llvm::Type* FloatTy;
- const llvm::Type* DoubleTy;
+ llvm::Type* FloatTy;
+ llvm::Type* DoubleTy;
- const llvm::Type* Int8PtrTy;
+ llvm::Type* Int8PtrTy;
llvm::Value* Zero;
llvm::Value* One;
@@ -137,7 +137,7 @@ namespace rubinius {
llvm::Module* module() { return module_; }
llvm::ExecutionEngine* engine() { return engine_; }
llvm::FunctionPassManager* passes() { return passes_; }
- const llvm::Type* object() { return object_; }
+ llvm::Type* object() { return object_; }
int jitted_methods() {
return jitted_methods_;
@@ -226,8 +226,8 @@ namespace rubinius {
method_update_lock_.unlock();
}
- const llvm::Type* ptr_type(std::string name);
- const llvm::Type* type(std::string name);
+ llvm::Type* ptr_type(std::string name);
+ llvm::Type* type(std::string name);
void compile_soon(STATE, CompiledMethod* cm, Object* extra, bool is_block=false);
void remove(llvm::Function* func);
@@ -256,11 +256,11 @@ namespace rubinius {
class Signature {
protected:
LLVMState* ls_;
- std::vector<const llvm::Type*> types_;
- const llvm::Type* ret_type_;
+ std::vector<llvm::Type*> types_;
+ llvm::Type* ret_type_;
public:
- Signature(LLVMState* ls, const llvm::Type* rt)
+ Signature(LLVMState* ls, llvm::Type* rt)
: ls_(ls)
, ret_type_(rt)
{}
@@ -270,7 +270,7 @@ namespace rubinius {
, ret_type_(ls->ptr_type(rt))
{}
- std::vector<const llvm::Type*>& types() {
+ std::vector<llvm::Type*>& types() {
return types_;
}
@@ -280,7 +280,7 @@ namespace rubinius {
return *this;
}
- Signature& operator<<(const llvm::Type* type) {
+ Signature& operator<<(llvm::Type* type) {
types_.push_back(type);
return *this;
@@ -302,17 +302,17 @@ namespace rubinius {
llvm::CallInst* call(const char* name, llvm::Value** start, int size,
const char* inst_name, llvm::BasicBlock* block) {
- return llvm::CallInst::Create(function(name), start, start+size, inst_name, block);
+ return llvm::CallInst::Create(function(name), llvm::ArrayRef<llvm::Value*>(start, size), inst_name, block);
}
llvm::CallInst* call(const char* name, llvm::Value** start, int size,
const char* inst_name, llvm::IRBuilder<>& builder) {
- return builder.CreateCall(function(name), start, start+size, inst_name);
+ return builder.CreateCall(function(name), llvm::ArrayRef<llvm::Value*>(start, size), inst_name);
}
llvm::CallInst* call(const char* name, std::vector<llvm::Value*> args,
const char* inst_name, llvm::IRBuilder<>& builder) {
- return builder.CreateCall(function(name), args.begin(), args.end(), inst_name);
+ return builder.CreateCall(function(name), args, inst_name);
}
};
View
4 vm/llvm/types.cpp
@@ -17,14 +17,14 @@ namespace type {
ls->cint(source_id_)
};
- node = llvm::MDNode::get(ls->ctx(), impMD, 4);
+ node = llvm::MDNode::get(ls->ctx(), impMD);
} else {
llvm::Value *impMD[] = {
ls->cint(kind_),
ls->cint(value_)
};
- node = llvm::MDNode::get(ls->ctx(), impMD, 2);
+ node = llvm::MDNode::get(ls->ctx(), impMD);
}
I->setMetadata(ls->metadata_id(), node);
View
1,213 vm/llvm/types.cpp.gen
@@ -6,410 +6,983 @@ Module* makeLLVMModuleContents(Module *mod) {
mod->setModuleIdentifier("vm/gen/types.bc");
// Type Definitions
-std::vector<const Type*>StructTy_struct_rubinius__Arguments_fields;
-OpaqueType* OpaqueTy_struct_rubinius__Symbol = OpaqueType::get(mod->getContext());
-mod->addTypeName("struct.rubinius::Symbol", OpaqueTy_struct_rubinius__Symbol);
+std::vector<Type*>FuncTy_0_args;
+StructType *StructTy_struct_rubinius__Arguments = mod->getTypeByName("struct.rubinius::Arguments");
+if (!StructTy_struct_rubinius__Arguments) {
+StructTy_struct_rubinius__Arguments = StructType::create(mod->getContext(), "struct.rubinius::Arguments");
+}
+std::vector<Type*>StructTy_struct_rubinius__Arguments_fields;
+StructType *StructTy_struct_rubinius__Symbol = mod->getTypeByName("struct.rubinius::Symbol");
+if (!StructTy_struct_rubinius__Symbol) {
+StructTy_struct_rubinius__Symbol = StructType::create(mod->getContext(), "struct.rubinius::Symbol");
+}
+std::vector<Type*>StructTy_struct_rubinius__Symbol_fields;
+if (StructTy_struct_rubinius__Symbol->isOpaque()) {
+StructTy_struct_rubinius__Symbol->setBody(StructTy_struct_rubinius__Symbol_fields, /*isPacked=*/false);
+}
-PointerType* PointerTy_0 = PointerType::get(OpaqueTy_struct_rubinius__Symbol, 0);
+PointerType* PointerTy_2 = PointerType::get(StructTy_struct_rubinius__Symbol, 0);
-StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_0);
-std::vector<const Type*>StructTy_struct_rubinius__Object_fields;
-std::vector<const Type*>StructTy_struct_rubinius__ObjectHeader_fields;
-std::vector<const Type*>StructTy_union_rubinius__HeaderWord_fields;
+StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_2);
+StructType *StructTy_struct_rubinius__Object = mod->getTypeByName("struct.rubinius::Object");
+if (!StructTy_struct_rubinius__Object) {
+StructTy_struct_rubinius__Object = StructType::create(mod->getContext(), "struct.rubinius::Object");
+}
+std::vector<Type*>StructTy_struct_rubinius__Object_fields;
+StructType *StructTy_struct_rubinius__ObjectHeader = mod->getTypeByName("struct.rubinius::ObjectHeader");
+if (!StructTy_struct_rubinius__ObjectHeader) {
+StructTy_struct_rubinius__ObjectHeader = StructType::create(mod->getContext(), "struct.rubinius::ObjectHeader");
+}
+std::vector<Type*>StructTy_struct_rubinius__ObjectHeader_fields;
+StructType *StructTy_union_rubinius__HeaderWord = mod->getTypeByName("union.rubinius::HeaderWord");
+if (!StructTy_union_rubinius__HeaderWord) {
+StructTy_union_rubinius__HeaderWord = StructType::create(mod->getContext(), "union.rubinius::HeaderWord");
+}
+std::vector<Type*>StructTy_union_rubinius__HeaderWord_fields;
StructTy_union_rubinius__HeaderWord_fields.push_back(IntegerType::get(mod->getContext(), 64));
-StructType* StructTy_union_rubinius__HeaderWord = StructType::get(mod->getContext(), StructTy_union_rubinius__HeaderWord_fields, /*isPacked=*/false);
-mod->addTypeName("union.rubinius::HeaderWord", StructTy_union_rubinius__HeaderWord);
+if (StructTy_union_rubinius__HeaderWord->isOpaque()) {
+StructTy_union_rubinius__HeaderWord->setBody(StructTy_union_rubinius__HeaderWord_fields, /*isPacked=*/false);
+}
StructTy_struct_rubinius__ObjectHeader_fields.push_back(StructTy_union_rubinius__HeaderWord);
-std::vector<const Type*>StructTy_struct_rubinius__Class_fields;
-std::vector<const Type*>StructTy_struct_rubinius__Module_fields;
-PATypeHolder StructTy_struct_rubinius__Object_fwd = OpaqueType::get(mod->getContext());
-StructTy_struct_rubinius__Module_fields.push_back(StructTy_struct_rubinius__Object_fwd);
-OpaqueType* OpaqueTy_struct_rubinius__MethodTable = OpaqueType::get(mod->getContext());
-mod->addTypeName("struct.rubinius::MethodTable", OpaqueTy_struct_rubinius__MethodTable);
+StructType *StructTy_struct_rubinius__Class = mod->getTypeByName("struct.rubinius::Class");
+if (!StructTy_struct_rubinius__Class) {
+StructTy_struct_rubinius__Class = StructType::create(mod->getContext(), "struct.rubinius::Class");
+}
+std::vector<Type*>StructTy_struct_rubinius__Class_fields;
+StructType *StructTy_struct_rubinius__Module = mod->getTypeByName("struct.rubinius::Module");
+if (!StructTy_struct_rubinius__Module) {
+StructTy_struct_rubinius__Module = StructType::create(mod->getContext(), "struct.rubinius::Module");
+}
+std::vector<Type*>StructTy_struct_rubinius__Module_fields;
+StructTy_struct_rubinius__Module_fields.push_back(StructTy_struct_rubinius__Object);
+StructType *StructTy_struct_rubinius__MethodTable = mod->getTypeByName("struct.rubinius::MethodTable");
+if (!StructTy_struct_rubinius__MethodTable) {
+StructTy_struct_rubinius__MethodTable = StructType::create(mod->getContext(), "struct.rubinius::MethodTable");
+}
+std::vector<Type*>StructTy_struct_rubinius__MethodTable_fields;
+if (StructTy_struct_rubinius__MethodTable->isOpaque()) {
+StructTy_struct_rubinius__MethodTable->setBody(StructTy_struct_rubinius__MethodTable_fields, /*isPacked=*/false);
+}
-PointerType* PointerTy_3 = PointerType::get(OpaqueTy_struct_rubinius__MethodTable, 0);
+PointerType* PointerTy_5 = PointerType::get(StructTy_struct_rubinius__MethodTable, 0);
-StructTy_struct_rubinius__Module_fields.push_back(PointerTy_3);
-StructTy_struct_rubinius__Module_fields.push_back(PointerTy_0);
-OpaqueType* OpaqueTy_struct_rubinius__LookupTable = OpaqueType::get(mod->getContext());
-mod->addTypeName("struct.rubinius::LookupTable", OpaqueTy_struct_rubinius__LookupTable);
+StructTy_struct_rubinius__Module_fields.push_back(PointerTy_5);
+StructTy_struct_rubinius__Module_fields.push_back(PointerTy_2);
+StructType *StructTy_struct_rubinius__LookupTable = mod->getTypeByName("struct.rubinius::LookupTable");
+if (!StructTy_struct_rubinius__LookupTable) {
+StructTy_struct_rubinius__LookupTable = StructType::create(mod->getContext(), "struct.rubinius::LookupTable");
+}
+std::vector<Type*>StructTy_struct_rubinius__LookupTable_fields;
+if (StructTy_struct_rubinius__LookupTable->isOpaque()) {
+StructTy_struct_rubinius__LookupTable->setBody(StructTy_struct_rubinius__LookupTable_fields, /*isPacked=*/false);
+}
-PointerType* PointerTy_4 = PointerType::get(OpaqueTy_struct_rubinius__LookupTable, 0);
+PointerType* PointerTy_6 = PointerType::get(StructTy_struct_rubinius__LookupTable, 0);
-StructTy_struct_rubinius__Module_fields.push_back(PointerTy_4);
-PATypeHolder StructTy_struct_rubinius__Module_fwd = OpaqueType::get(mod->getContext());
-PointerType* PointerTy_5 = PointerType::get(StructTy_struct_rubinius__Module_fwd, 0);
+StructTy_struct_rubinius__Module_fields.push_back(PointerTy_6);
+PointerType* PointerTy_7 = PointerType::get(StructTy_struct_rubinius__Module, 0);
-StructTy_struct_rubinius__Module_fields.push_back(PointerTy_5);
-std::vector<const Type*>StructTy_struct_rubinius__Array_fields;
-StructTy_struct_rubinius__Array_fields.push_back(StructTy_struct_rubinius__Object_fwd);
-OpaqueType* OpaqueTy_struct_rubinius__Fixnum = OpaqueType::get(mod->getContext());
-mod->addTypeName("struct.rubinius::Fixnum", OpaqueTy_struct_rubinius__Fixnum);
+StructTy_struct_rubinius__Module_fields.push_back(PointerTy_7);
+StructType *StructTy_struct_rubinius__Array = mod->getTypeByName("struct.rubinius::Array");
+if (!StructTy_struct_rubinius__Array) {
+StructTy_struct_rubinius__Array = StructType::create(mod->getContext(), "struct.rubinius::Array");
+}
+std::vector<Type*>StructTy_struct_rubinius__Array_fields;
+StructTy_struct_rubinius__Array_fields.push_back(StructTy_struct_rubinius__Object);
+StructType *StructTy_struct_rubinius__Fixnum = mod->getTypeByName("struct.rubinius::Fixnum");
+if (!StructTy_struct_rubinius__Fixnum) {
+StructTy_struct_rubinius__Fixnum = StructType::create(mod->getContext(), "struct.rubinius::Fixnum");
+}
+std::vector<Type*>StructTy_struct_rubinius__Fixnum_fields;
+if (StructTy_struct_rubinius__Fixnum->isOpaque()) {
+StructTy_struct_rubinius__Fixnum->setBody(StructTy_struct_rubinius__Fixnum_fields, /*isPacked=*/false);
+}
-PointerType* PointerTy_7 = PointerType::get(OpaqueTy_struct_rubinius__Fixnum, 0);
+PointerType* PointerTy_9 = PointerType::get(StructTy_struct_rubinius__Fixnum, 0);
-StructTy_struct_rubinius__Array_fields.push_back(PointerTy_7);
-std::vector<const Type*>StructTy_struct_rubinius__Tuple_fields;
-StructTy_struct_rubinius__Tuple_fields.push_back(StructTy_struct_rubinius__Object_fwd);
+StructTy_struct_rubinius__Array_fields.push_back(PointerTy_9);
+StructType *StructTy_struct_rubinius__Tuple = mod->getTypeByName("struct.rubinius::Tuple");
+if (!StructTy_struct_rubinius__Tuple) {
+StructTy_struct_rubinius__Tuple = StructType::create(mod->getContext(), "struct.rubinius::Tuple");
+}
+std::vector<Type*>StructTy_struct_rubinius__Tuple_fields;
+StructTy_struct_rubinius__Tuple_fields.push_back(StructTy_struct_rubinius__Object);
StructTy_struct_rubinius__Tuple_fields.push_back(IntegerType::get(mod->getContext(), 32));
-PATypeHolder PointerTy_1_fwd = OpaqueType::get(mod->getContext());
-ArrayType* ArrayTy_9 = ArrayType::get(PointerTy_1_fwd, 0);
+PointerType* PointerTy_3 = PointerType::get(StructTy_struct_rubinius__Object, 0);
-StructTy_struct_rubinius__Tuple_fields.push_back(ArrayTy_9);
-StructType* StructTy_struct_rubinius__Tuple = StructType::get(mod->getContext(), StructTy_struct_rubinius__Tuple_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::Tuple", StructTy_struct_rubinius__Tuple);
+ArrayType* ArrayTy_11 = ArrayType::get(PointerTy_3, 0);
-PointerType* PointerTy_8 = PointerType::get(StructTy_struct_rubinius__Tuple, 0);
+StructTy_struct_rubinius__Tuple_fields.push_back(ArrayTy_11);
+if (StructTy_struct_rubinius__Tuple->isOpaque()) {
+StructTy_struct_rubinius__Tuple->setBody(StructTy_struct_rubinius__Tuple_fields, /*isPacked=*/false);
+}
-StructTy_struct_rubinius__Array_fields.push_back(PointerTy_8);
-StructTy_struct_rubinius__Array_fields.push_back(PointerTy_7);
-StructTy_struct_rubinius__Array_fields.push_back(PointerTy_1_fwd);
-StructType* StructTy_struct_rubinius__Array = StructType::get(mod->getContext(), StructTy_struct_rubinius__Array_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::Array", StructTy_struct_rubinius__Array);
+PointerType* PointerTy_10 = PointerType::get(StructTy_struct_rubinius__Tuple, 0);
-PointerType* PointerTy_6 = PointerType::get(StructTy_struct_rubinius__Array, 0);
+StructTy_struct_rubinius__Array_fields.push_back(PointerTy_10);
+StructTy_struct_rubinius__Array_fields.push_back(PointerTy_9);
+StructTy_struct_rubinius__Array_fields.push_back(PointerTy_3);
+if (StructTy_struct_rubinius__Array->isOpaque()) {
+StructTy_struct_rubinius__Array->setBody(StructTy_struct_rubinius__Array_fields, /*isPacked=*/false);
+}
-StructTy_struct_rubinius__Module_fields.push_back(PointerTy_6);
-StructType* StructTy_struct_rubinius__Module = StructType::get(mod->getContext(), StructTy_struct_rubinius__Module_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::Module", StructTy_struct_rubinius__Module);
-cast<OpaqueType>(StructTy_struct_rubinius__Module_fwd.get())->refineAbstractTypeTo(StructTy_struct_rubinius__Module);
-StructTy_struct_rubinius__Module = cast<StructType>(StructTy_struct_rubinius__Module_fwd.get());
+PointerType* PointerTy_8 = PointerType::get(StructTy_struct_rubinius__Array, 0);
+StructTy_struct_rubinius__Module_fields.push_back(PointerTy_8);
+if (StructTy_struct_rubinius__Module->isOpaque()) {
+StructTy_struct_rubinius__Module->setBody(StructTy_struct_rubinius__Module_fields, /*isPacked=*/false);
+}
StructTy_struct_rubinius__Class_fields.push_back(StructTy_struct_rubinius__Module);
-StructTy_struct_rubinius__Class_fields.push_back(PointerTy_7);
-StructTy_struct_rubinius__Class_fields.push_back(PointerTy_4);
-OpaqueType* OpaqueTy_struct_rubinius__TypeInfo = OpaqueType::get(mod->getContext());
-mod->addTypeName("struct.rubinius::TypeInfo", OpaqueTy_struct_rubinius__TypeInfo);
+StructTy_struct_rubinius__Class_fields.push_back(PointerTy_9);
+StructTy_struct_rubinius__Class_fields.push_back(PointerTy_6);
+StructType *StructTy_struct_rubinius__TypeInfo = mod->getTypeByName("struct.rubinius::TypeInfo");
+if (!StructTy_struct_rubinius__TypeInfo) {
+StructTy_struct_rubinius__TypeInfo = StructType::create(mod->getContext(), "struct.rubinius::TypeInfo");
+}
+std::vector<Type*>StructTy_struct_rubinius__TypeInfo_fields;
+if (StructTy_struct_rubinius__TypeInfo->isOpaque()) {
+StructTy_struct_rubinius__TypeInfo->setBody(StructTy_struct_rubinius__TypeInfo_fields, /*isPacked=*/false);
+}
-PointerType* PointerTy_10 = PointerType::get(OpaqueTy_struct_rubinius__TypeInfo, 0);
+PointerType* PointerTy_12 = PointerType::get(StructTy_struct_rubinius__TypeInfo, 0);
-StructTy_struct_rubinius__Class_fields.push_back(PointerTy_10);
+StructTy_struct_rubinius__Class_fields.push_back(PointerTy_12);
StructTy_struct_rubinius__Class_fields.push_back(IntegerType::get(mod->getContext(), 32));
StructTy_struct_rubinius__Class_fields.push_back(IntegerType::get(mod->getContext(), 32));
StructTy_struct_rubinius__Class_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructType* StructTy_struct_rubinius__Class = StructType::get(mod->getContext(), StructTy_struct_rubinius__Class_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::Class", StructTy_struct_rubinius__Class);
+if (StructTy_struct_rubinius__Class->isOpaque()) {
+StructTy_struct_rubinius__Class->setBody(StructTy_struct_rubinius__Class_fields, /*isPacked=*/false);
+}
-PointerType* PointerTy_2 = PointerType::get(StructTy_struct_rubinius__Class, 0);
+PointerType* PointerTy_4 = PointerType::get(StructTy_struct_rubinius__Class, 0);
-StructTy_struct_rubinius__ObjectHeader_fields.push_back(PointerTy_2);
-StructTy_struct_rubinius__ObjectHeader_fields.push_back(PointerTy_1_fwd);
-PointerType* PointerTy_12 = PointerType::get(IntegerType::get(mod->getContext(), 8), 0);
+StructTy_struct_rubinius__ObjectHeader_fields.push_back(PointerTy_4);
+StructTy_struct_rubinius__ObjectHeader_fields.push_back(PointerTy_3);
+PointerType* PointerTy_14 = PointerType::get(IntegerType::get(mod->getContext(), 8), 0);
-ArrayType* ArrayTy_11 = ArrayType::get(PointerTy_12, 0);
+ArrayType* ArrayTy_13 = ArrayType::get(PointerTy_14, 0);
-StructTy_struct_rubinius__ObjectHeader_fields.push_back(ArrayTy_11);
-StructType* StructTy_struct_rubinius__ObjectHeader = StructType::get(mod->getContext(), StructTy_struct_rubinius__ObjectHeader_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::ObjectHeader", StructTy_struct_rubinius__ObjectHeader);
+StructTy_struct_rubinius__ObjectHeader_fields.push_back(ArrayTy_13);
+if (StructTy_struct_rubinius__ObjectHeader->isOpaque()) {
+StructTy_struct_rubinius__ObjectHeader->setBody(StructTy_struct_rubinius__ObjectHeader_fields, /*isPacked=*/false);
+}
StructTy_struct_rubinius__Object_fields.push_back(StructTy_struct_rubinius__ObjectHeader);
-StructType* StructTy_struct_rubinius__Object = StructType::get(mod->getContext(), StructTy_struct_rubinius__Object_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::Object", StructTy_struct_rubinius__Object);
-cast<OpaqueType>(StructTy_struct_rubinius__Object_fwd.get())->refineAbstractTypeTo(StructTy_struct_rubinius__Object);
-StructTy_struct_rubinius__Object = cast<StructType>(StructTy_struct_rubinius__Object_fwd.get());
+if (StructTy_struct_rubinius__Object->isOpaque()) {
+StructTy_struct_rubinius__Object->setBody(StructTy_struct_rubinius__Object_fields, /*isPacked=*/false);
+}
-PointerType* PointerTy_1 = PointerType::get(StructTy_struct_rubinius__Object, 0);
-cast<OpaqueType>(PointerTy_1_fwd.get())->refineAbstractTypeTo(PointerTy_1);
-PointerTy_1 = cast<PointerType>(PointerTy_1_fwd.get());
+StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_3);
+StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_3);
+StructTy_struct_rubinius__Arguments_fields.push_back(IntegerType::get(mod->getContext(), 32));
+PointerType* PointerTy_15 = PointerType::get(PointerTy_3, 0);
+StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_15);
+StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_10);
+if (StructTy_struct_rubinius__Arguments->isOpaque()) {
+StructTy_struct_rubinius__Arguments->setBody(StructTy_struct_rubinius__Arguments_fields, /*isPacked=*/false);
+}
-StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_1);
-StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_1);
-StructTy_struct_rubinius__Arguments_fields.push_back(IntegerType::get(mod->getContext(), 32));
-PointerType* PointerTy_13 = PointerType::get(PointerTy_1, 0);
+PointerType* PointerTy_1 = PointerType::get(StructTy_struct_rubinius__Arguments, 0);
-StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_13);
-StructTy_struct_rubinius__Arguments_fields.push_back(PointerTy_8);
-StructType* StructTy_struct_rubinius__Arguments = StructType::get(mod->getContext(), StructTy_struct_rubinius__Arguments_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::Arguments", StructTy_struct_rubinius__Arguments);
+FuncTy_0_args.push_back(PointerTy_1);
+FunctionType* FuncTy_0 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_0_args,
+ /*isVarArg=*/false);
-mod->addTypeName("struct.rubinius::Array", StructTy_struct_rubinius__Array);
-std::vector<const Type*>StructTy_struct_rubinius__BlockEnvironment_fields;
-StructTy_struct_rubinius__BlockEnvironment_fields.push_back(StructTy_struct_rubinius__Object);
-std::vector<const Type*>StructTy_struct_rubinius__VariableScope_fields;
-StructTy_struct_rubinius__VariableScope_fields.push_back(StructTy_struct_rubinius__Object);
-StructTy_struct_rubinius__VariableScope_fields.push_back(PointerTy_1);
-std::vector<const Type*>StructTy_struct_rubinius__CompiledMethod_fields;
-std::vector<const Type*>StructTy_struct_rubinius__Executable_fields;
+std::vector<Type*>FuncTy_16_args;
+StructType *StructTy_struct_rubinius__jit__RuntimeData = mod->getTypeByName("struct.rubinius::jit::RuntimeData");
+if (!StructTy_struct_rubinius__jit__RuntimeData) {
+StructTy_struct_rubinius__jit__RuntimeData = StructType::create(mod->getContext(), "struct.rubinius::jit::RuntimeData");
+}
+std::vector<Type*>StructTy_struct_rubinius__jit__RuntimeData_fields;
+StructType *StructTy_struct_rubinius__CompiledMethod = mod->getTypeByName("struct.rubinius::CompiledMethod");
+if (!StructTy_struct_rubinius__CompiledMethod) {
+StructTy_struct_rubinius__CompiledMethod = StructType::create(mod->getContext(), "struct.rubinius::CompiledMethod");
+}
+std::vector<Type*>StructTy_struct_rubinius__CompiledMethod_fields;
+StructType *StructTy_struct_rubinius__Executable = mod->getTypeByName("struct.rubinius::Executable");
+if (!StructTy_struct_rubinius__Executable) {
+StructTy_struct_rubinius__Executable = StructType::create(mod->getContext(), "struct.rubinius::Executable");
+}
+std::vector<Type*>StructTy_struct_rubinius__Executable_fields;
StructTy_struct_rubinius__Executable_fields.push_back(StructTy_struct_rubinius__Object);
-StructTy_struct_rubinius__Executable_fields.push_back(PointerTy_0);
-StructTy_struct_rubinius__Executable_fields.push_back(PointerTy_7);
-std::vector<const Type*>FuncTy_17_args;
-OpaqueType* OpaqueTy_struct_rubinius__VM = OpaqueType::get(mod->getContext());
-mod->addTypeName("struct.rubinius::VM", OpaqueTy_struct_rubinius__VM);
-
-PointerType* PointerTy_18 = PointerType::get(OpaqueTy_struct_rubinius__VM, 0);
-
-FuncTy_17_args.push_back(PointerTy_18);
-std::vector<const Type*>StructTy_struct_rubinius__CallFrame_fields;
-PATypeHolder PointerTy_19_fwd = OpaqueType::get(mod->getContext());
-StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_19_fwd);
-OpaqueType* OpaqueTy_struct_rubinius__StaticScope = OpaqueType::get(mod->getContext());
-mod->addTypeName("struct.rubinius::StaticScope", OpaqueTy_struct_rubinius__StaticScope);
-
-PointerType* PointerTy_20 = PointerType::get(OpaqueTy_struct_rubinius__StaticScope, 0);
-
-StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_20);
-StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_12);
-PATypeHolder PointerTy_15_fwd = OpaqueType::get(mod->getContext());
-StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_15_fwd);
+StructTy_struct_rubinius__Executable_fields.push_back(PointerTy_2);
+StructTy_struct_rubinius__Executable_fields.push_back(PointerTy_9);
+std::vector<Type*>FuncTy_20_args;
+StructType *StructTy_struct_rubinius__VM = mod->getTypeByName("struct.rubinius::VM");
+if (!StructTy_struct_rubinius__VM) {
+StructTy_struct_rubinius__VM = StructType::create(mod->getContext(), "struct.rubinius::VM");
+}
+std::vector<Type*>StructTy_struct_rubinius__VM_fields;
+if (StructTy_struct_rubinius__VM->isOpaque()) {
+StructTy_struct_rubinius__VM->setBody(StructTy_struct_rubinius__VM_fields, /*isPacked=*/false);
+}
+
+PointerType* PointerTy_21 = PointerType::get(StructTy_struct_rubinius__VM, 0);
+
+FuncTy_20_args.push_back(PointerTy_21);
+StructType *StructTy_struct_rubinius__CallFrame = mod->getTypeByName("struct.rubinius::CallFrame");
+if (!StructTy_struct_rubinius__CallFrame) {
+StructTy_struct_rubinius__CallFrame = StructType::create(mod->getContext(), "struct.rubinius::CallFrame");
+}
+std::vector<Type*>StructTy_struct_rubinius__CallFrame_fields;
+PointerType* PointerTy_22 = PointerType::get(StructTy_struct_rubinius__CallFrame, 0);
+
+StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_22);
+StructType *StructTy_struct_rubinius__StaticScope = mod->getTypeByName("struct.rubinius::StaticScope");
+if (!StructTy_struct_rubinius__StaticScope) {
+StructTy_struct_rubinius__StaticScope = StructType::create(mod->getContext(), "struct.rubinius::StaticScope");
+}
+std::vector<Type*>StructTy_struct_rubinius__StaticScope_fields;
+if (StructTy_struct_rubinius__StaticScope->isOpaque()) {
+StructTy_struct_rubinius__StaticScope->setBody(StructTy_struct_rubinius__StaticScope_fields, /*isPacked=*/false);
+}
+
+PointerType* PointerTy_23 = PointerType::get(StructTy_struct_rubinius__StaticScope, 0);
+
+StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_23);
+StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_14);
+PointerType* PointerTy_18 = PointerType::get(StructTy_struct_rubinius__CompiledMethod, 0);
+
+StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_18);
StructTy_struct_rubinius__CallFrame_fields.push_back(IntegerType::get(mod->getContext(), 32));
StructTy_struct_rubinius__CallFrame_fields.push_back(IntegerType::get(mod->getContext(), 32));
-StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_12);
-PATypeHolder PointerTy_14_fwd = OpaqueType::get(mod->getContext());
-StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_14_fwd);
-std::vector<const Type*>StructTy_struct_rubinius__StackVariables_fields;
-StructTy_struct_rubinius__StackVariables_fields.push_back(PointerTy_14_fwd);
-StructTy_struct_rubinius__StackVariables_fields.push_back(PointerTy_14_fwd);
-StructTy_struct_rubinius__StackVariables_fields.push_back(PointerTy_1);
-StructTy_struct_rubinius__StackVariables_fields.push_back(PointerTy_1);
-StructTy_struct_rubinius__StackVariables_fields.push_back(PointerTy_5);
-StructTy_struct_rubinius__StackVariables_fields.push_back(PointerTy_1);
-StructTy_struct_rubinius__StackVariables_fields.push_back(ArrayTy_9);
-StructType* StructTy_struct_rubinius__StackVariables = StructType::get(mod->getContext(), StructTy_struct_rubinius__StackVariables_fields, /*isPacked=*/false);
-mod->addTypeName("struct.rubinius::StackVariables", StructTy_struct_rubinius__StackVariables);
-
-PointerType* PointerTy_21 = PointerType::get(StructTy_struct_rubinius__StackVariables, 0);
-
-StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_21);
-PointerType* PointerTy_22 = PointerType::get(StructTy_struct_rubinius__Arguments, 0);
+StructTy_struct_rubinius__CallFrame_fields.push_back(PointerTy_14);
+StructType *StructTy_struct_rubinius__VariableScope = mod->getTypeByName("struct.rubinius::VariableScope");