[LLVMdev] RFC: ThinLTO Impementation Plan

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri May 15 14:41:47 PDT 2015


> On 2015-May-15, at 13:15, Teresa Johnson <tejohnson at google.com> wrote:
> 
> What isn't clear to me is what all uses the available
> externally linkage type currently - do you happen to know?

It's used for the `inline` keyword in the C language.  If you do a
`git grep available_externally -- test/` inside a clang checkout you
might find some other uses.

$ cat available-externally.c 
inline int foo(int i) { return i; }
int bar(int i) { return foo(i); }
$ clang -S -emit-llvm -O1 available-externally.c -o -
; ModuleID = 'available-externally.c'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"

; Function Attrs: nounwind readnone ssp uwtable
define i32 @bar(i32 %i) #0 {
  %1 = tail call i32 @foo(i32 %i)
  ret i32 %1
}

; Function Attrs: inlinehint nounwind readnone ssp uwtable
define available_externally i32 @foo(i32 %i) #1 {
  ret i32 %i
}

attributes #0 = { nounwind readnone ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { inlinehint nounwind readnone ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.module.flags = !{!0}
!llvm.ident = !{!1}

!0 = !{i32 1, !"PIC Level", i32 2}
!1 = !{!"Apple LLVM version 7.0.0 (clang-700.9.38.2)"}





More information about the llvm-dev mailing list