Skip to content

Instantly share code, notes, and snippets.

; ModuleID = '<stdin>'
define void @main() nounwind {
%r.1 = alloca double ; <double*> [#uses=3]
store double 1.000000e+00, double* %r.1
%r.9 = alloca double ; <double*> [#uses=3]
store double 9.000000e+00, double* %r.9
br label %loop
loop: ; preds = %switch, %0
@str = internal constant [4 x i8] c"%d\0A\00"
define void @main() nounwind {
%fact = call i32 @fact.tr(i32 5)
call i32 @printf( i8* getelementptr ([4 x i8]* @str, i32 0,i32 0), i32 %fact)
ret void
}
; tail recurse
define i32 @fact.tr(i32 %n) nounwind {
diff --git a/ext/llvm_basicblock.cpp b/ext/llvm_basicblock.cpp
index e9937b1..83b5bc4 100644
--- a/ext/llvm_basicblock.cpp
+++ b/ext/llvm_basicblock.cpp
@@ -133,7 +133,7 @@ llvm_builder_malloc(VALUE self, VALUE rtype, VALUE rsize) {
const Type *type;
Data_Get_Struct(rtype, Type, type);
- Value *size = ConstantInt::get(Type::Int32Ty, FIX2INT(rsize));
+ Value *size = ConstantInt::get(Type::getInt32Ty(getGlobalContext()), FIX2INT(rsize));
" treetop.vim
" syntax file for treetop.
" Author: NANKI Haruo.
let b:ruby_no_expensive=1
syntax match ttOperators /[&~!*+?\/]/
syntax keyword ttDefine end
syntax keyword ttKeywords include super