unsigned char produce(void);
void consume(unsigned char);
static unsigned char x = 3;
unsigned char y = 4;
void myEntry(void)
{
x = produce();
consume(y);
}
; ModuleID = '/tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/source.c'
source_filename = "/tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/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"
@y = dso_local global i8 4, align 1
@x = internal global i8 3, align 1
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @myEntry() #0 {
%1 = call zeroext i8 @produce()
store i8 %1, i8* @x, align 1
%2 = load i8, i8* @y, align 1
call void @consume(i8 zeroext %2)
ret void
}
declare dso_local zeroext i8 @produce() #1
declare dso_local void @consume(i8 zeroext) #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 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="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-XsnJGMYj2HtCueYu-10962529496185989789/source.c'
source_filename = "/tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/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"
@y = dso_local global i8 4, align 1, !dbg !0
@x = internal global i8 3, align 1, !dbg !6
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @myEntry() #0 !dbg !14 {
%1 = call zeroext i8 @produce(), !dbg !17
store i8 %1, i8* @x, align 1, !dbg !18
%2 = load i8, i8* @y, align 1, !dbg !19
call void @consume(i8 zeroext %2), !dbg !20
ret void, !dbg !21
}
declare dso_local zeroext i8 @produce() #1
declare dso_local void @consume(i8 zeroext) #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 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="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.dbg.cu = !{!2}
!llvm.module.flags = !{!10, !11, !12}
!llvm.ident = !{!13}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "y", scope: !2, file: !8, line: 4, type: !9, isLocal: false, isDefinition: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "Debian clang version 11.0.1-2", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)
!3 = !DIFile(filename: "/tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/source.c", directory: "/__w/semicompiled/semicompiled")
!4 = !{}
!5 = !{!0, !6}
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
!7 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !8, line: 3, type: !9, isLocal: true, isDefinition: true)
!8 = !DIFile(filename: "/tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/source.c", directory: "")
!9 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char)
!10 = !{i32 7, !"Dwarf Version", i32 4}
!11 = !{i32 2, !"Debug Info Version", i32 3}
!12 = !{i32 1, !"wchar_size", i32 4}
!13 = !{!"Debian clang version 11.0.1-2"}
!14 = distinct !DISubprogram(name: "myEntry", scope: !8, file: !8, line: 5, type: !15, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
!15 = !DISubroutineType(types: !16)
!16 = !{null}
!17 = !DILocation(line: 7, column: 9, scope: !14)
!18 = !DILocation(line: 7, column: 7, scope: !14)
!19 = !DILocation(line: 8, column: 13, scope: !14)
!20 = !DILocation(line: 8, column: 5, scope: !14)
!21 = !DILocation(line: 9, column: 1, scope: !14)
(module
(type (;0;) (func))
(type (;1;) (func (param i32)))
(type (;2;) (func (result i32)))
(import "env" "produce" (func (;0;) (type 2)))
(import "env" "consume" (func (;1;) (type 1)))
(import "env" "__stack_pointer" (global (;0;) (mut i32)))
(import "env" "__memory_base" (global (;1;) i32))
(import "env" "__table_base" (global (;2;) i32))
(import "GOT.mem" "y" (global (;3;) (mut i32)))
(import "env" "memory" (memory (;0;) 0))
(import "env" "__indirect_function_table" (table (;0;) 0 funcref))
(func (;2;) (type 0)
call 3)
(func (;3;) (type 0))
(func (;4;) (type 0)
(local i32 i32 i32 i32 i32 i32 i32 i32)
call 0
local.set 0
i32.const 1
local.set 1
global.get 1
local.set 2
local.get 2
local.get 1
i32.add
local.set 3
local.get 3
local.get 0
i32.store8
global.get 3
local.set 4
local.get 4
i32.load8_u
local.set 5
i32.const 255
local.set 6
local.get 5
local.get 6
i32.and
local.set 7
local.get 7
call 1
return)
(global (;4;) i32 (i32.const 0))
(global (;5;) i32 (i32.const 0))
(export "__post_instantiate" (func 2))
(export "__wasm_apply_relocs" (func 3))
(export "myEntry" (func 4))
(export "y" (global 4))
(export "__dso_handle" (global 5))
(data (;0;) (global.get 1) "\04\03"))
/tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/source.o: file format elf64-bpf
Disassembly of section .text:
0000000000000000 <myEntry>:
; myEntry():
; /tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/source.c:7
; x = produce();
0: call -1
1: r1 = 1 ll
3: *(u8 *)(r1 + 0) = r0
; /tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/source.c:8
; consume(y);
4: r1 = 0 ll
6: r1 = *(u8 *)(r1 + 0)
7: call -1
; /tmp/semicompiled-XsnJGMYj2HtCueYu-10962529496185989789/source.c:9
; }
8: exit
Join the thriving social scene at github.com/andrewbaxter/semicompiled.