From b718eca643df13010e3369a15899cb9adad432ec Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Wed, 20 May 2015 13:16:42 +0000 Subject: [mips] The naming convention for private labels is ABI dependant. Summary: For N32/N64, private labels begin with '.L' but for O32 they begin with '$'. MCAsmInfo now has an initializer function which can be used to provide information from the TargetMachine to control the assembly syntax. Reviewers: vkalintiris Reviewed By: vkalintiris Subscribers: jfb, sandeep, llvm-commits, rafael Differential Revision: http://reviews.llvm.org/D9821 llvm-svn: 237789 --- llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp') diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp index e2bd5a815ab..b47ca0b5cb5 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp @@ -12,7 +12,10 @@ //===----------------------------------------------------------------------===// #include "MipsMCAsmInfo.h" +#include "MCTargetDesc/MipsABIInfo.h" +#include "MipsTargetMachine.h" #include "llvm/ADT/Triple.h" +#include "llvm/Target/TargetMachine.h" using namespace llvm; @@ -29,12 +32,14 @@ MipsMCAsmInfo::MipsMCAsmInfo(StringRef TT) { PointerSize = CalleeSaveStackSlotSize = 8; } + // These two are overridden in finishInit() + PrivateGlobalPrefix = "$"; + PrivateLabelPrefix = "$"; + AlignmentIsInBytes = false; Data16bitsDirective = "\t.2byte\t"; Data32bitsDirective = "\t.4byte\t"; Data64bitsDirective = "\t.8byte\t"; - PrivateGlobalPrefix = "$"; - PrivateLabelPrefix = "$"; CommentString = "#"; ZeroDirective = "\t.space\t"; GPRel32Directive = "\t.gpword\t"; @@ -44,3 +49,9 @@ MipsMCAsmInfo::MipsMCAsmInfo(StringRef TT) { ExceptionsType = ExceptionHandling::DwarfCFI; DwarfRegNumForCFI = true; } + +void MipsMCAsmInfo::finishInit(const LLVMTargetMachine &TM) { + const MipsABIInfo &ABI = static_cast(TM).getABI(); + PrivateGlobalPrefix = ABI.GetPrivateLabelPrefix(); + PrivateLabelPrefix = ABI.GetPrivateLabelPrefix(); +} -- cgit v1.2.3