Skip to content

Instantly share code, notes, and snippets.

@Zoxc Zoxc/nicer.ll
Created Jul 27, 2015

Embed
What would you like to do?
LLVM codegen
; ModuleID = 'nicer.ll'
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define i8 @test({ i8*, i64 } %arg, i64 %arg1) unnamed_addr {
"the block":
%tmp = extractvalue { i8*, i64 } %arg, 1
%tmp2 = icmp ugt i64 %tmp, %arg1
br i1 %tmp2, label %exit, label %cond.i
cond.i: ; preds = %"the block"
tail call void @fail()
unreachable
exit: ; preds = %"the block" ; preds = %"the block"
%tmp7 = extractvalue { i8*, i64 } %arg, 0
%tmp5 = getelementptr inbounds i8* %tmp7, i64 %arg1
%tmp6 = load i8* %tmp5, align 1
ret i8 %tmp6
}
declare void @fail() unnamed_addr noreturn
.text
.file "nicer.ll"
.globl test
.align 16, 0x90
.type test,@function
test: # @test
.cfi_startproc
# BB#0: # %the block
pushq %rax
.Ltmp0:
.cfi_def_cfa_offset 16
cmpq %rdx, %rsi
jbe .LBB0_2
# BB#1: # %exit
movb (%rdi,%rdx), %al
popq %rdx
retq
.LBB0_2: # %cond.i
callq fail
.Ltmp1:
.size test, .Ltmp1-test
.cfi_endproc
.section ".note.GNU-stack","",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.