[llvm] r284203 - In preparation for removing getNameWithPrefix off of TargetMachine,

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 10:38:38 PDT 2016


I've reverted this thusly:

echristo at dzur ~/s/llvm> git svn dcommit
Committing to https://llvm.org/svn/llvm-project/llvm/trunk ...
M lib/CodeGen/TargetLoweringObjectFileImpl.cpp
M lib/Target/TargetMachine.cpp
Committed r284252

since it was causing ubsan objections.

-eric

On Thu, Oct 13, 2016 at 10:56 PM Eric Christopher via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: echristo
> Date: Fri Oct 14 00:47:41 2016
> New Revision: 284203
>
> URL: http://llvm.org/viewvc/llvm-project?rev=284203&view=rev
> Log:
> In preparation for removing getNameWithPrefix off of TargetMachine,
> sink the current behavior into the callers and sink
> TargetMachine::getNameWithPrefix into TargetMachine::getSymbol.
>
> Modified:
>     llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
>     llvm/trunk/lib/Target/TargetMachine.cpp
>
> Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=284203&r1=284202&r2=284203&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
> +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Fri Oct 14
> 00:47:41 2016
> @@ -301,7 +301,7 @@ selectELFSectionForGlobal(MCContext &Ctx
>
>    if (EmitUniqueSection && UniqueSectionNames) {
>      Name.push_back('.');
> -    TM.getNameWithPrefix(Name, GV, Mang, true);
> +    Mang.getNameWithPrefix(Name, GV, false);
>    }
>    unsigned UniqueID = MCContext::GenericSectionID;
>    if (EmitUniqueSection && !UniqueSectionNames) {
> @@ -817,6 +817,13 @@ static bool canUsePrivateLabel(const MCA
>  void TargetLoweringObjectFileMachO::getNameWithPrefix(
>      SmallVectorImpl<char> &OutName, const GlobalValue *GV,
>      const TargetMachine &TM) const {
> +  if (!GV->hasPrivateLinkage()) {
> +    // Simple case: If GV is not private, it is not important to find out
> if
> +    // private labels are legal in this case or not.
> +    getMangler().getNameWithPrefix(OutName, GV, false);
> +    return;
> +  }
> +
>    SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
>    const MCSection *TheSection = SectionForGlobal(GV, GVKind, TM);
>    bool CannotUsePrivateLabel =
>
> Modified: llvm/trunk/lib/Target/TargetMachine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=284203&r1=284202&r2=284203&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/TargetMachine.cpp (original)
> +++ llvm/trunk/lib/Target/TargetMachine.cpp Fri Oct 14 00:47:41 2016
> @@ -203,19 +203,13 @@ TargetIRAnalysis TargetMachine::getTarge
>  void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
>                                        const GlobalValue *GV, Mangler
> &Mang,
>                                        bool MayAlwaysUsePrivate) const {
> -  if (MayAlwaysUsePrivate || !GV->hasPrivateLinkage()) {
> -    // Simple case: If GV is not private, it is not important to find out
> if
> -    // private labels are legal in this case or not.
> -    Mang.getNameWithPrefix(Name, GV, false);
> -    return;
> -  }
>    const TargetLoweringObjectFile *TLOF = getObjFileLowering();
>    TLOF->getNameWithPrefix(Name, GV, *this);
>  }
>
>  MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang)
> const {
>    SmallString<128> NameStr;
> -  getNameWithPrefix(NameStr, GV, Mang);
>    const TargetLoweringObjectFile *TLOF = getObjFileLowering();
> +  TLOF->getNameWithPrefix(NameStr, GV, *this);
>    return TLOF->getContext().getOrCreateSymbol(NameStr);
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161014/aa1526dc/attachment.html>


More information about the llvm-commits mailing list