void myFunc(int x)
{
myFunc(x + 1);
}
; ModuleID = '/tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c'
source_filename = "/tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @myFunc(i32 %0) #0 {
%2 = alloca i32, align 4
store i32 %0, i32* %2, align 4
%3 = load i32, i32* %2, align 4
%4 = add nsw i32 %3, 1
call void @myFunc(i32 %4)
ret void
}
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"Debian clang version 11.0.1-2"}
; ModuleID = '/tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c'
source_filename = "/tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @myFunc(i32 %0) #0 !dbg !7 {
%2 = alloca i32, align 4
store i32 %0, i32* %2, align 4
call void @llvm.dbg.declare(metadata i32* %2, metadata !12, metadata !DIExpression()), !dbg !13
%3 = load i32, i32* %2, align 4, !dbg !14
%4 = add nsw i32 %3, 1, !dbg !15
call void @myFunc(i32 %4), !dbg !16
ret void, !dbg !17
}
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable willreturn }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5}
!llvm.ident = !{!6}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Debian clang version 11.0.1-2", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "/tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c", directory: "/__w/semicompiled/semicompiled")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"Debian clang version 11.0.1-2"}
!7 = distinct !DISubprogram(name: "myFunc", scope: !8, file: !8, line: 1, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
!8 = !DIFile(filename: "/tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c", directory: "")
!9 = !DISubroutineType(types: !10)
!10 = !{null, !11}
!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!12 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !8, line: 1, type: !11)
!13 = !DILocation(line: 1, column: 17, scope: !7)
!14 = !DILocation(line: 3, column: 12, scope: !7)
!15 = !DILocation(line: 3, column: 14, scope: !7)
!16 = !DILocation(line: 3, column: 5, scope: !7)
!17 = !DILocation(line: 4, column: 1, scope: !7)
(module
(type (;0;) (func))
(type (;1;) (func (param i32)))
(import "env" "__stack_pointer" (global (;0;) (mut i32)))
(import "env" "__memory_base" (global (;1;) i32))
(import "env" "__table_base" (global (;2;) i32))
(import "env" "memory" (memory (;0;) 0))
(import "env" "__indirect_function_table" (table (;0;) 0 funcref))
(func (;0;) (type 0)
call 1)
(func (;1;) (type 0))
(func (;2;) (type 1) (param i32)
(local i32 i32 i32 i32 i32 i32 i32 i32)
global.get 0
local.set 1
i32.const 16
local.set 2
local.get 1
local.get 2
i32.sub
local.set 3
local.get 3
global.set 0
local.get 3
local.get 0
i32.store offset=12
local.get 3
i32.load offset=12
local.set 4
i32.const 1
local.set 5
local.get 4
local.get 5
i32.add
local.set 6
local.get 6
call 2
i32.const 16
local.set 7
local.get 3
local.get 7
i32.add
local.set 8
local.get 8
global.set 0
return)
(global (;3;) i32 (i32.const 0))
(export "__post_instantiate" (func 0))
(export "__wasm_apply_relocs" (func 1))
(export "myFunc" (func 2))
(export "__dso_handle" (global 3)))
/tmp/semicompiled-vV6JIoIT-13713780551226962163/source.o: file format elf64-bpf
Disassembly of section .text:
0000000000000000 <myFunc>:
; myFunc():
; /tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c:2
; {
0: r2 = r1
1: *(u32 *)(r10 - 4) = r1
; /tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c:3
; myFunc(x + 1);
2: r1 = *(u32 *)(r10 - 4)
3: r1 += 1
4: *(u64 *)(r10 - 16) = r2
5: call -1
; /tmp/semicompiled-vV6JIoIT-13713780551226962163/source.c:4
; }
6: exit
Join the thriving social scene at github.com/andrewbaxter/semicompiled.