Skip to content

Instantly share code, notes, and snippets.

@markflorisson
Created September 24, 2013 13:48
Show Gist options
  • Save markflorisson/6685020 to your computer and use it in GitHub Desktop.
Save markflorisson/6685020 to your computer and use it in GitHub Desktop.
[0] [14:46] ~/numba-nextgen git(master!) ➤ cat test.py
from numba2 import jit
@jit
def f(a, b):
return a < b
print f(10, 20)
[0] [14:46] ~/numba-nextgen git(master!) ➤ ./bin/numba test.py
--------------- numba2.compiler.frontend.frontend.translate ---------------
5 0 LOAD_FAST 0 (a)
3 LOAD_FAST 1 (b)
6 COMPARE_OP 0 (<)
9 RETURN_VALUE
function Opaque .f(Opaque %a, Opaque %b) {
Block:
%0 = (Pointer(base=Opaque())) alloca()
%1 = (Void) store(%a, %0)
%2 = (Pointer(base=Opaque())) alloca()
%3 = (Void) store(%b, %2)
%4 = (Opaque) load(%0)
%5 = (Opaque) load(%2)
%6 = (Opaque) pycall(%const(Opaque, <built-in function lt>), %4, %5)
%7 = (Void) ret(%6)
}
--------------- numba2.prettyprint.dump_cfg ---------------
--------------- numba2.compiler.simplification ---------------
function Opaque .f(Opaque %a, Opaque %b) {
Block:
%0 = (Pointer(base=Opaque())) alloca()
%1 = (Void) store(%a, %0)
%2 = (Pointer(base=Opaque())) alloca()
%3 = (Void) store(%b, %2)
%4 = (Opaque) load(%0)
%5 = (Opaque) load(%2)
- %6 = (Opaque) pycall(%const(Opaque, <built-in function lt>), %4, %5)
+ %8 = (Opaque) getfield(%4, %__lt__)
+ %9 = (Opaque) call(%8, %['4', '5'])
- %7 = (Void) ret(%6)
? ^
+ %7 = (Void) ret(%9)
? ^
}
--------------- pykit.analysis.cfa ---------------
function Opaque .f(Opaque %a, Opaque %b) {
Block:
- %0 = (Pointer(base=Opaque())) alloca()
- %1 = (Void) store(%a, %0)
- %2 = (Pointer(base=Opaque())) alloca()
- %3 = (Void) store(%b, %2)
- %4 = (Opaque) load(%0)
- %5 = (Opaque) load(%2)
- %8 = (Opaque) getfield(%4, %__lt__)
? ^
+ %8 = (Opaque) getfield(%a, %__lt__)
? ^
- %9 = (Opaque) call(%8, %['4', '5'])
? ^ ^
+ %9 = (Opaque) call(%8, %['a', 'b'])
? ^ ^
%7 = (Void) ret(%9)
}
--------------- numba2.compiler.typing.inference ---------------
--------------- numba2.compiler.typing.resolution.resolve_context ---------------
--------------- numba2.compiler.typing.resolution.resolve_restype ---------------
--------------- numba2.compiler.typing.resolution.rewrite_methods ---------------
function Opaque .f(Opaque %a, Opaque %b) {
Block:
%8 = (Opaque) getfield(%a, %__lt__)
- %9 = (Opaque) call(%8, %['a', 'b'])
? ^
+ %9 = (Opaque) call(%lt, %['a', 'b'])
? ^^
%7 = (Void) ret(%9)
}
--------------- pykit.transform.dce ---------------
function Opaque .f(Opaque %a, Opaque %b) {
Block:
- %8 = (Opaque) getfield(%a, %__lt__)
%9 = (Opaque) call(%lt, %['a', 'b'])
%7 = (Void) ret(%9)
}
--------------- numba2.compiler.backend.preparation ---------------
- function Opaque .f(Opaque %a, Opaque %b) {
+ function Bool .f(Int32 %a, Int32 %b) {
Block:
- %9 = (Opaque) call(%lt, %['a', 'b'])
? ^^^^^^
+ %9 = (Bool) call(%lt, %['a', 'b'])
? ^^^^
%7 = (Void) ret(%9)
}
--------------- numba2.compiler.backend.backend ---------------
- function Bool .f(Int32 %a, Int32 %b) {
- Block:
- %9 = (Bool) call(%lt, %['a', 'b'])
- %7 = (Void) ret(%9)
+ define i1 @.f(i32, i32) {
+ .f:
+ %2 = call i1 @lt(i32 %0, i32 %1)
+ ret i1 %2
}
--------------- pykit.codegen.llvm.verify ---------------
--------------- numba2.prettyprint.dump_llvm ---------------
--------------- pykit.codegen.llvm.optimize ---------------
- define i1 @.f(i32, i32) {
+ define i1 @.f(i32, i32) nounwind readnone {
.f:
- %2 = call i1 @lt(i32 %0, i32 %1)
+ %"4.i" = icmp slt i32 %0, %1
- ret i1 %2
? ^
+ ret i1 %"4.i"
? ^^^^^
}
--------------- numba2.prettyprint.dump_optimized ---------------
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment