[PATCH] D15000: [ELF] - Implemented @tlsgd optimization (GD->IE case, x64).
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 2 15:10:18 PST 2015
ruiu added inline comments.
================
Comment at: ELF/OutputSections.cpp:221-226
@@ -220,2 +220,8 @@
if (Body && Target->isTlsGlobalDynamicReloc(Type)) {
+ if (Target->isTlsOptimized(Type, Body)) {
+ P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
+ Target->getTlsGotReloc(), Config->Mips64EL);
+ P->r_offset = Out<ELFT>::Got->getEntryAddr(*Body);
+ return true;
+ }
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
----------------
Can you reduce the nest level by moving this `if` outside of the outer `if? I mean
if (Body && Target->isTlsOptimized(Type, Body)) {
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
Target->getTlsGotReloc(), Config->Mips64EL);
P->r_offset = Out<ELFT>::Got->getEntryAddr(*Body);
return true;
}
if (Body && Target->isTlsGlobalDynamicReloc(Type)) {
...
}
================
Comment at: ELF/Target.cpp:494-495
@@ -489,3 +493,4 @@
-bool X86_64TargetInfo::isTlsOptimized(unsigned Type,
- const SymbolBody *S) const {
+// Returns optimization level. 0 - not optimized,
+// 1 - partial, other values - full.
+uint32_t X86_64TargetInfo::isTlsOptimized(unsigned Type,
----------------
I don't think these magic numbers are good. In fact it seems that you don't need them. Please see the comment below.
================
Comment at: ELF/Target.cpp:624
@@ +623,3 @@
+ case R_X86_64_TLSGD: {
+ if (isTlsOptimized(Type, &S) == 1)
+ relocateTlsGdToIe(Loc, BufEnd, P, SA);
----------------
This can be
if (canBePreempted(&S, true))
http://reviews.llvm.org/D15000
More information about the llvm-commits
mailing list