Skip to content

Instantly share code, notes, and snippets.

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

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()
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
.file "nicer.ll"
.globl test
.align 16, 0x90
.type test,@function
test: # @test
# BB#0: # %the block
pushq %rax
.cfi_def_cfa_offset 16
cmpq %rdx, %rsi
jbe .LBB0_2
# BB#1: # %exit
movb (%rdi,%rdx), %al
popq %rdx
.LBB0_2: # %cond.i
callq fail
.size test, .Ltmp1-test
.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.