> 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)"}
On Fri, May 15, 2015 at 2:41 PM, Duncan P. N. Exon Smith < dexonsmith at apple.com> wrote:> > > 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.I was about to say... then I see you mentioned C. C's weird inline semantics are... weird. (but yes, available externally) I think we also emit vtable constants as available externally to enable some constant-prop/inlining/devirtualization.> 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)"} > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150515/d4e10bfe/attachment.html>
On Fri, May 15, 2015 at 2:46 PM, David Blaikie <dblaikie at gmail.com> wrote:> > > On Fri, May 15, 2015 at 2:41 PM, Duncan P. N. Exon Smith < > dexonsmith at apple.com> wrote: > >> >> > 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. > > > I was about to say... then I see you mentioned C. C's weird inline > semantics are... weird. (but yes, available externally) > >To add more to the fun: C99 extern inline and gnu C behave the opposite way. David> I think we also emit vtable constants as available externally to enable > some constant-prop/inlining/devirtualization. > > >> 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)"} >> >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150515/f6923b29/attachment.html>