[llvm] r270205 - Simplify handling of hidden stubs on PowerPC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 05:00:52 PDT 2016
Author: rafael
Date: Fri May 20 07:00:52 2016
New Revision: 270205
URL: http://llvm.org/viewvc/llvm-project?rev=270205&view=rev
Log:
Simplify handling of hidden stubs on PowerPC.
We now handle them just like non hidden ones. This was already the case
on x86 (r207518) and arm (r207517).
Modified:
llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
llvm/trunk/test/CodeGen/PowerPC/indirect-hidden.ll
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h?rev=270205&r1=270204&r2=270205&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h Fri May 20 07:00:52 2016
@@ -32,12 +32,6 @@ class MachineModuleInfoMachO : public Ma
/// is true if this GV is external.
DenseMap<MCSymbol *, StubValueTy> GVStubs;
- /// HiddenGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
- /// "Lfoo$non_lazy_ptr", the value is something like "_foo". Unlike GVStubs
- /// these are for things with hidden visibility. The extra bit is true if
- /// this GV is external.
- DenseMap<MCSymbol *, StubValueTy> HiddenGVStubs;
-
/// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something
/// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
/// bit is true if this GV is external.
@@ -57,11 +51,6 @@ public:
return GVStubs[Sym];
}
- StubValueTy &getHiddenGVStubEntry(MCSymbol *Sym) {
- assert(Sym && "Key cannot be null");
- return HiddenGVStubs[Sym];
- }
-
StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
assert(Sym && "Key cannot be null");
return ThreadLocalGVStubs[Sym];
@@ -70,7 +59,6 @@ public:
/// Accessor methods to return the set of stubs in sorted order.
SymbolListTy GetFnStubList() { return getSortedStubs(FnStubs); }
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
- SymbolListTy GetHiddenGVStubList() { return getSortedStubs(HiddenGVStubs); }
SymbolListTy GetThreadLocalGVStubList() {
return getSortedStubs(ThreadLocalGVStubs);
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=270205&r1=270204&r2=270205&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri May 20 07:00:52 2016
@@ -214,7 +214,7 @@ void PPCAsmPrinter::printOperand(const M
SymToPrint = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
MachineModuleInfoImpl::StubValueTy &StubSym =
- MMI->getObjFileInfo<MachineModuleInfoMachO>().getHiddenGVStubEntry(
+ MMI->getObjFileInfo<MachineModuleInfoMachO>().getGVStubEntry(
SymToPrint);
if (!StubSym.getPointer())
StubSym = MachineModuleInfoImpl::
@@ -1571,25 +1571,6 @@ bool PPCDarwinAsmPrinter::doFinalization
}
Stubs.clear();
- OutStreamer->AddBlankLine();
- }
-
- Stubs = MMIMacho.GetHiddenGVStubList();
- if (!Stubs.empty()) {
- OutStreamer->SwitchSection(getObjFileLowering().getDataSection());
- EmitAlignment(isPPC64 ? 3 : 2);
-
- for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
- // L_foo$stub:
- OutStreamer->EmitLabel(Stubs[i].first);
- // .long _foo
- OutStreamer->EmitValue(MCSymbolRefExpr::
- create(Stubs[i].second.getPointer(),
- OutContext),
- isPPC64 ? 8 : 4/*size*/);
- }
-
- Stubs.clear();
OutStreamer->AddBlankLine();
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp?rev=270205&r1=270204&r2=270205&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp Fri May 20 07:00:52 2016
@@ -94,11 +94,9 @@ static MCSymbol *GetSymbolFromOperand(co
// then add the suffix.
if (MO.getTargetFlags() & PPCII::MO_NLP_FLAG) {
MachineModuleInfoMachO &MachO = getMachOMMI(AP);
-
- MachineModuleInfoImpl::StubValueTy &StubSym =
- (MO.getTargetFlags() & PPCII::MO_NLP_HIDDEN_FLAG) ?
- MachO.getHiddenGVStubEntry(Sym) : MachO.getGVStubEntry(Sym);
-
+
+ MachineModuleInfoImpl::StubValueTy &StubSym = MachO.getGVStubEntry(Sym);
+
if (!StubSym.getPointer()) {
assert(MO.isGlobal() && "Extern symbol not handled yet");
StubSym = MachineModuleInfoImpl::
Modified: llvm/trunk/test/CodeGen/PowerPC/indirect-hidden.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/indirect-hidden.ll?rev=270205&r1=270204&r2=270205&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/indirect-hidden.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/indirect-hidden.ll Fri May 20 07:00:52 2016
@@ -13,11 +13,9 @@ define i32* @get_b() {
; CHECK: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
; CHECK-NEXT: .p2align 2
+; CHECK-NEXT: L_a$non_lazy_ptr:
+; CHECK-NEXT: .indirect_symbol _a
+; CHECK-NEXT: .long 0
; CHECK-NEXT: L_b$non_lazy_ptr:
; CHECK-NEXT: .indirect_symbol _b
; CHECK-NEXT: .long 0
-
-; CHECK: .section __DATA,__data
-; CHECK-NEXT: .p2align 2
-; CHECK-NEXT: L_a$non_lazy_ptr:
-; CHECK-NEXT: .long _a
More information about the llvm-commits
mailing list