[llvm-dev] How to generate a .ll file with functions' parameter names

Alberto Barbaro via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 8 00:38:28 PST 2019


Hi all,
I'm trying to obtain a .ll with parameters name for every function. My
simple c C is the following:

int sum(int a, int b) {
return a+b;
}

int main() {
sum(1,2);
}

I obtain the .ll with the following commands:

clang -emit-llvm sum.c -c
llvm-dis-7 sum.bc

The obtained .ll is:

cat sum.ll
; ModuleID = 'sum.bc'
source_filename = "sum.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

; Function Attrs: noinline nounwind optnone uwtable
define i32 @sum(i32, i32) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 %0, i32* %3, align 4
  store i32 %1, i32* %4, align 4
  %5 = load i32, i32* %3, align 4
  %6 = load i32, i32* %4, align 4
  %7 = add nsw i32 %5, %6
  ret i32 %7
}

; Function Attrs: noinline nounwind optnone uwtable
define i32 @main() #0 {
  %1 = call i32 @sum(i32 1, i32 2)
  ret i32 0
}

attributes #0 = { noinline nounwind optnone uwtable
"correctly-rounded-divide-sqrt-fp-math"="false"
"disable-tail-calls"="false" "less-precise-fpmad"="false"
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"
"no-infs-fp-math"="false" "no-jump-tables"="false"
"no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false"
"no-trapping-math"="false" "stack-protector-buffer-size"="8"
"target-cpu"="x86-64" "target-features"="+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 = !{!"clang version 6.0.1-svn334776-1~exp1~20190309042703.125
(branches/release_60)"}

Could you tell me why I don't see a and b parameters for the sum function?

Thanks
Alberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191208/0d499d24/attachment.html>


More information about the llvm-dev mailing list