-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make some code easier to inline (rebased) #1105
Conversation
This is needed because previously we handled these with weak symbols, but the linker can no longer do this for us because everything is now in the same translation unit. Therefore, we reset these functions so that they no longer contain their "default" implementations when they get created by the compiler.
if $link; then | ||
for file in "$LIBDIR"/llvm/*.ll; do | ||
tmp="$tmpdir/$(basename "$file").o" | ||
if $visibility_hidden; then | ||
tmphidden="$tmpdir/$(basename "$file").hidden.bc" | ||
run @OPT@ "$file" -load-pass-plugin "$set_visibility_hidden" -set-visibility-hidden -o "$tmphidden" | ||
file="$tmphidden" | ||
fi | ||
run @LLC@ \ | ||
"$file" -mtriple=@BACKEND_TARGET_TRIPLE@ \ | ||
-filetype=obj "$llc_opt_flags" "${llc_flags[@]}" -o "$tmp" | ||
files+=("$tmp") | ||
done | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
lib/codegen/CreateTerm.cpp
Outdated
return | ||
#include "config/llvm_header.h" | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that this was possible! Awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just interested in the answer for the the question in Decision.cpp
. Feel free to merge after double-checking it!
The llvm backend was not being particularly intelligent about the ability to inline certain function calls. Here we move all the
.ll
files in theruntime
directory into the module used to initialize code generation. This allows these calls to live in one translation unit and be better optimized, while also simplifying llvm-kompile-clang.