Skip to content
Browse files

now requires LLVM r106781

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4271 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent 922141d commit 511105a79582c68380f7dfbfbe60c70c8a1fce5c Laurent Sansonetti committed Jun 24, 2010
Showing with 4 additions and 103 deletions.
  1. +2 −2 README.rdoc
  2. +0 −17 bridgesupport.cpp
  3. +1 −36 compiler.cpp
  4. +0 −3 debugger.cpp
  5. +0 −3 llvm.h
  6. +1 −39 vm.cpp
  7. +0 −3 vm.h
View
4 README.rdoc
@@ -24,10 +24,10 @@ http://macruby.org
* LLVM ToT, compiled for both i386 and x86_64.
LLVM is a moving target and breaks periodically. We recommend to install
- revision 89156, being sure to specify the correct C and C++ compilers through
+ revision 106781, being sure to specify the correct C and C++ compilers through
environment variables.
- $ svn co -r 89156 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk
+ $ svn co -r 106781 https://llvm.org/svn/llvm-project/llvm/trunk llvm-trunk
$ cd llvm-trunk
$ env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" CC=/usr/bin/gcc CXX=/usr/bin/g++ ./configure --enable-bindings=none --enable-optimized --with-llvmgccdir=/tmp
$ env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" CC=/usr/bin/gcc CXX=/usr/bin/g++ make
View
17 bridgesupport.cpp
@@ -16,9 +16,6 @@
# include <llvm/Constants.h>
# include <llvm/CallingConv.h>
# include <llvm/Instructions.h>
-# if !defined(LLVM_TOT)
-# include <llvm/ModuleProvider.h>
-# endif
# include <llvm/Intrinsics.h>
# include <llvm/Analysis/DebugInfo.h>
# include <llvm/ExecutionEngine/JIT.h>
@@ -331,7 +328,6 @@ RoxorCompiler::compile_bs_struct_new(rb_vm_bs_boxed_t *bs_boxed)
const size_t type_size = GET_CORE()->get_sizeof(llvm_type);
-#if LLVM_TOT
Value *args[] = {
new BitCastInst(fval, PtrTy, "", bb), // start
ConstantInt::get(Int8Ty, 0), // value
@@ -344,19 +340,6 @@ RoxorCompiler::compile_bs_struct_new(rb_vm_bs_boxed_t *bs_boxed)
Intrinsic::memset, Tys, 2);
assert(memset_func != NULL);
CallInst::Create(memset_func, args, args + 5, "", bb);
-#else
- const Type *Tys[] = { IntTy };
- Function *memset_func = Intrinsic::getDeclaration(module,
- Intrinsic::memset, Tys, 1);
- assert(memset_func != NULL);
- Value *args[] = {
- new BitCastInst(fval, PtrTy, "", bb),
- ConstantInt::get(Int8Ty, 0),
- ConstantInt::get(IntTy, type_size),
- ConstantInt::get(Int32Ty, 0)
- };
- CallInst::Create(memset_func, args, args + 4, "", bb);
-#endif
fval = new LoadInst(fval, "", bb);
fval = compile_conversion_to_ruby(ftype, llvm_type, fval);
View
37 compiler.cpp
@@ -307,14 +307,7 @@ RoxorCompiler::RoxorCompiler(bool _debug_mode)
level = 0;
#endif
-#if LLVM_TOT
dbg_mdkind = context.getMDKindID("dbg");
-#else
- dbg_mdkind = context.getMetadata().getMDKind("dbg");
- if (dbg_mdkind == 0) {
- dbg_mdkind = context.getMetadata().registerMDKind("dbg");
- }
-#endif
assert(dbg_mdkind != 0);
}
@@ -799,12 +792,7 @@ RoxorCompiler::attach_current_line_metadata(Instruction *insn)
if (fname != NULL) {
DILocation loc = debug_info->CreateLocation(current_line, 0,
debug_compile_unit, DILocation(NULL));
-#if LLVM_TOT
insn->setMetadata(dbg_mdkind, loc);
- //insn->setDebugLoc(DebugLoc::getFromDILocation(loc.getNode()));
-#else
- context.getMetadata().addMD(dbg_mdkind, loc.getNode(), insn);
-#endif
}
}
@@ -2528,18 +2516,11 @@ RoxorCompiler::inline_function_calls(Function *f)
}
}
-#if LLVM_TOT
InlineFunctionInfo IFI;
for (std::vector<CallInst *>::iterator i = insns.begin();
i != insns.end(); ++i) {
InlineFunction(*i, IFI);
}
-#else
- for (std::vector<CallInst *>::iterator i = insns.begin();
- i != insns.end(); ++i) {
- InlineFunction(*i);
- }
-#endif
}
Function *
@@ -2832,7 +2813,6 @@ RoxorCompiler::compile_scope(NODE *node)
// Transform the InvokeInst in CallInst.
std::vector<Value *> params;
-#if LLVM_TOT
for (unsigned i = 0; i < invoke->getNumOperands() - 3; i++) {
params.push_back(invoke->getOperand(i));
}
@@ -2843,22 +2823,7 @@ RoxorCompiler::compile_scope(NODE *node)
invoke);
invoke->replaceAllUsesWith(call_inst);
- BasicBlock *normal_bb = dyn_cast<BasicBlock>
- (invoke->getNormalDest());
-#else
- for (InvokeInst::op_iterator op_it = invoke->op_begin()+3;
- op_it != invoke->op_end(); ++op_it) {
- params.push_back(op_it->get());
- }
- CallInst *call_inst = CallInst::Create(
- invoke->getOperand(0),
- params.begin(), params.end(),
- invoke->getNameStr(),
- invoke);
-
- invoke->replaceAllUsesWith(call_inst);
- BasicBlock *normal_bb = dyn_cast<BasicBlock>(invoke->getOperand(1));
-#endif
+ BasicBlock *normal_bb = dyn_cast<BasicBlock>(invoke->getNormalDest());
assert(normal_bb != NULL);
BranchInst::Create(normal_bb, invoke);
invoke->eraseFromParent();
View
3 debugger.cpp
@@ -13,9 +13,6 @@
#include <llvm/Constants.h>
#include <llvm/CallingConv.h>
#include <llvm/Instructions.h>
-#if !defined(LLVM_TOT)
-# include <llvm/ModuleProvider.h>
-#endif
#include <llvm/Intrinsics.h>
#include <llvm/Analysis/DebugInfo.h>
#include <llvm/ExecutionEngine/JIT.h>
View
3 llvm.h
@@ -15,9 +15,6 @@
#include <llvm/Constants.h>
#include <llvm/CallingConv.h>
#include <llvm/Instructions.h>
-#if !defined(LLVM_TOT)
-# include <llvm/ModuleProvider.h>
-#endif
#include <llvm/Intrinsics.h>
#include <llvm/Analysis/DebugInfo.h>
#include <llvm/ExecutionEngine/JIT.h>
View
40 vm.cpp
@@ -19,9 +19,6 @@
# include <llvm/Constants.h>
# include <llvm/CallingConv.h>
# include <llvm/Instructions.h>
-# if !defined(LLVM_TOT)
-# include <llvm/ModuleProvider.h>
-# endif
# include <llvm/PassManager.h>
# include <llvm/Analysis/DebugInfo.h>
# include <llvm/Analysis/Verifier.h>
@@ -267,7 +264,6 @@ class RoxorJITManager : public JITMemoryManager, public JITEventListener {
std::string path;
for (std::vector<EmittedFunctionDetails::LineStart>::const_iterator iter = Details.LineStarts.begin(); iter != Details.LineStarts.end(); ++iter) {
-#if LLVM_TOT
MDNode *scope = iter->Loc.getAsMDNode(F.getContext());
DILocation dil = DILocation(scope);
if (path.size() == 0) {
@@ -277,16 +273,6 @@ class RoxorJITManager : public JITMemoryManager, public JITEventListener {
path.append(scope.getFilename());
}
RoxorFunction::Line line(iter->Address, dil.getLineNumber());
-#else
- DebugLocTuple dlt = Details.MF->getDebugLocTuple(iter->Loc);
- if (path.size() == 0) {
- DICompileUnit unit(dlt.Scope);
- path.append(unit.getDirectory());
- path.append("/");
- path.append(unit.getFilename());
- }
- RoxorFunction::Line line(iter->Address, dlt.Line);
-#endif
function->lines.push_back(line);
}
@@ -326,9 +312,6 @@ RoxorCore::RoxorCore(void)
// The JIT is created later, if necessary.
InitializeNativeTarget();
-# if !defined(LLVM_TOT)
- emp = NULL;
-# endif
jmm = NULL;
ee = NULL;
fpm = NULL;
@@ -344,9 +327,6 @@ RoxorCore::prepare_jit(void)
{
#if !defined(MACRUBY_STATIC)
assert(ee == NULL);
-# if !defined(LLVM_TOT)
- emp = new ExistingModuleProvider(RoxorCompiler::module);
-# endif
jmm = new RoxorJITManager;
CodeGenOpt::Level opt = CodeGenOpt::Default;
@@ -376,24 +356,16 @@ RoxorCore::prepare_jit(void)
}
std::string err;
-# if LLVM_TOT
ee = ExecutionEngine::createJIT(RoxorCompiler::module, &err, jmm, opt,
false);
-# else
- ee = ExecutionEngine::createJIT(emp, &err, jmm, opt, false);
-# endif
if (ee == NULL) {
fprintf(stderr, "error while creating JIT: %s\n", err.c_str());
abort();
}
ee->DisableLazyCompilation();
ee->RegisterJITEventListener(jmm);
-# if LLVM_TOT
fpm = new FunctionPassManager(RoxorCompiler::module);
-# else
- fpm = new FunctionPassManager(emp);
-# endif
fpm->add(new TargetData(*ee->getTargetData()));
// Do simple "peephole" optimizations and bit-twiddling optzns.
@@ -4720,11 +4692,7 @@ Init_PreVM(void)
{
#if !defined(MACRUBY_STATIC)
// To emit DWARF exception tables.
-#if LLVM_TOT
llvm::JITExceptionHandling = true;
-#else
- llvm::DwarfExceptionHandling = true;
-#endif
// To emit DWARF debug metadata.
llvm::JITEmitDebugInfo = true;
// To not interfere with our signal handling mechanism.
@@ -4756,13 +4724,7 @@ Init_PreVM(void)
kernel_end = kernel_beg + _objs_kernel_i386_bc_len - 1;
#endif
-#if LLVM_TOT
- mbuf = MemoryBuffer::getMemBuffer(StringRef(kernel_beg,
- kernel_end - kernel_beg));
-#else
- mbuf = MemoryBuffer::getMemBuffer(kernel_beg, kernel_end);
- assert(mbuf != NULL);
-#endif
+ mbuf = MemoryBuffer::getMemBuffer(StringRef(kernel_beg, kernel_end - kernel_beg));
}
std::string err;
RoxorCompiler::module = ParseBitcodeFile(mbuf, getGlobalContext(), &err);
View
3 vm.h
@@ -669,9 +669,6 @@ class RoxorCore {
private:
// LLVM objects.
#if !defined(MACRUBY_STATIC)
-# if !defined(LLVM_TOT)
- ExistingModuleProvider *emp;
-# endif
RoxorJITManager *jmm;
ExecutionEngine *ee;
FunctionPassManager *fpm;

0 comments on commit 511105a

Please sign in to comment.
Something went wrong with that request. Please try again.