Skip to content

Instantly share code, notes, and snippets.

@carlokok

carlokok/test.ll Secret

Last active January 11, 2018 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlokok/579b7793465cd0299cf4c609c569f559 to your computer and use it in GitHub Desktop.
Save carlokok/579b7793465cd0299cf4c609c569f559 to your computer and use it in GitHub Desktop.
source_filename = "Island"
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32"
define void @go(i8) #7 {
BasicBlock15557:
%1 = icmp sgt i8 %0, -1
br i1 %1, label %BasicBlock15559, label %BasicBlock15561
BasicBlock15559:
tail call void @llvm.trap()
unreachable
BasicBlock15561:
ret void
}
declare void @llvm.trap()
define void @Test() {
call void @go(i8 12)
ret void
}
/*
llc -O0 test.ll -filetype=asm -o -
.text
.file "Island"
.section .text.go,"",@
.globl go # -- Begin function go
.type go,@function
go: # @go
.param i32
.local i32, i32, i32, i32, i32, i32, i32
# BB#0: # %BasicBlock15557
i32.const $push0=, 255
set_local 1, $pop0
i32.const $push1=, 255
set_local 2, $pop1
get_local $push4=, 0
get_local $push3=, 2
i32.and $push2=, $pop4, $pop3
set_local 3, $pop2
i32.const $push5=, 255
set_local 4, $pop5
get_local $push8=, 1
get_local $push7=, 4
i32.and $push6=, $pop8, $pop7
set_local 5, $pop6
get_local $push11=, 3
get_local $push10=, 5
i32.gt_s $push9=, $pop11, $pop10
set_local 6, $pop9
get_local $push12=, 6
set_local 7, $pop12
block
get_local $push13=, 7
i32.eqz $push14=, $pop13
br_if 0, $pop14 # 0: down to label0
# BB#1: # %BasicBlock15559
unreachable
unreachable
.LBB0_2: # %BasicBlock15561
end_block # label0:
return
end_function
.Lfunc_end0:
.size go, .Lfunc_end0-go
# -- End function
.section .text.Test,"",@
.globl Test # -- Begin function Test
.type Test,@function
Test: # @Test
.local i32
# BB#0:
i32.const $push0=, 12
set_local 0, $pop0
get_local $push1=, 0
call go@FUNCTION, $pop1
return
end_function
.Lfunc_end1:
.size Test, .Lfunc_end1-Test
# -- End function
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment