Created
June 15, 2009 22:27
-
-
Save patrickt/130390 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local:~/Repositories/MacRuby VM_DUMP_IR=1 ./miniruby -e "def f(x,y); x/y; end;" | |
IR dump ---------------------------------------------- | |
; ModuleID = 'Roxor' | |
@redefined = internal global i1 false ; <i1*> [#uses=1] | |
define i64 @0(i64 %self, i8* %sel) { | |
MainBlock: | |
tail call void @rb_vm_prepare_method(i64 140735081247880, i8* inttoptr (i64 4310314656 to i8*), i8* inttoptr (i64 4370479232 to i8*), i8* inttoptr (i64 8590190784 to i8*)) | |
ret i64 4 | |
} | |
define i64 @1(i64 %self, i8* %sel, i64 %x, i64 %y) { | |
MainBlock: | |
%0 = alloca i64 ; <i64*> [#uses=2] | |
store i64 %x, i64* %0 | |
%1 = alloca i64 ; <i64*> [#uses=2] | |
store i64 %y, i64* %1 | |
%2 = alloca i8* ; <i8**> [#uses=1] | |
%3 = inttoptr i64 0 to i8* ; <i8*> [#uses=1] | |
store i8* %3, i8** %2 | |
br label %entry_point | |
entry_point: ; preds = %MainBlock | |
%4 = inttoptr i64 4310314368 to i8* ; <i8*> [#uses=1] | |
%5 = load i64* %0 ; <i64> [#uses=4] | |
%6 = inttoptr i64 4309812880 to i8* ; <i8*> [#uses=1] | |
%7 = inttoptr i64 0 to i8* ; <i8*> [#uses=0] | |
%8 = load i64* %1 ; <i64> [#uses=4] | |
%9 = inttoptr i64 0 to i8* ; <i8*> [#uses=1] | |
%10 = load i1* @redefined ; <i1> [#uses=1] | |
%11 = icmp eq i1 %10, false ; <i1> [#uses=1] | |
br i1 %11, label %op_not_redefined, label %op_dispatch | |
op_not_redefined: ; preds = %entry_point | |
%12 = and i64 %5, 3 ; <i64> [#uses=1] | |
%13 = and i64 %8, 3 ; <i64> [#uses=1] | |
%14 = add i64 %12, %13 ; <i64> [#uses=1] | |
switch i64 %14, label %op_dispatch [ | |
i64 6, label %op_optimize_floating | |
i64 2, label %op_optimize_integral | |
] | |
op_optimize_floating: ; preds = %op_not_redefined | |
%15 = xor i64 %5, 3 ; <i64> [#uses=1] | |
%16 = xor i64 %8, 3 ; <i64> [#uses=1] | |
%17 = bitcast i64 %15 to double ; <double> [#uses=1] | |
%18 = bitcast i64 %16 to double ; <double> [#uses=1] | |
%19 = fdiv double %17, %18 ; <double> [#uses=1] | |
%20 = bitcast double %19 to i64 ; <i64> [#uses=1] | |
%21 = or i64 %20, 3 ; <i64> [#uses=1] | |
br label %op_merge | |
op_optimize_integral: ; preds = %op_not_redefined | |
%22 = ashr i64 %5, 2 ; <i64> [#uses=1] | |
%23 = ashr i64 %8, 2 ; <i64> [#uses=1] | |
%24 = sdiv i64 %22, %23 ; <i64> [#uses=1] | |
%25 = shl i64 %24, 2 ; <i64> [#uses=1] | |
%26 = or i64 %25, 1 ; <i64> [#uses=1] | |
br label %op_merge | |
op_dispatch: ; preds = %op_not_redefined, %entry_point | |
%27 = call i64 (i8*, i64, i8*, i8*, i8, i32, ...)* @rb_vm_dispatch(i8* %4, i64 %5, i8* %6, i8* %9, i8 0, i32 1, i64 %8) ; <i64> [#uses=1] | |
br label %op_merge | |
op_merge: ; preds = %op_dispatch, %op_optimize_integral, %op_optimize_floating | |
%op_tmp = phi i64 [ %21, %op_optimize_floating ], [ %26, %op_optimize_integral ], [ %27, %op_dispatch ] ; <i64> [#uses=1] | |
ret i64 %op_tmp | |
} | |
declare i64 @rb_vm_dispatch(i8*, i64, i8*, i8*, i8, i32, ...) | |
declare void @rb_vm_prepare_method(i64, i8*, i8*, i8*) | |
------------------------------------------------------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment