Revert "[NVPTX] Disable parens for identifiers starting with '$'"

This reverts commit 78d70a1c97.

Failed on Mips32:
https://lab.llvm.org/buildbot#builders/109/builds/36628

   # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26
   <stdin>:580:2: note: possible intended match here
   # fixup A - offset: 0, value: $tmp0, kind: fixup_Mips_26
This commit is contained in:
Andrew Savonichev 2022-04-14 21:25:31 +03:00
parent 664c111c95
commit 5193f2a558
4 changed files with 2 additions and 28 deletions

View File

@ -478,10 +478,6 @@ protected:
/// For example, foo(plt) instead of foo@plt. Defaults to false.
bool UseParensForSymbolVariant = false;
/// True if the target uses parens for symbol names starting with
/// '$' character to distinguish them from absolute names.
bool UseParensForDollarSignNames = true;
/// True if the target supports flags in ".loc" directive, false if only
/// location is allowed.
bool SupportsExtendedDwarfLocDirective = true;
@ -793,9 +789,6 @@ public:
bool doDwarfFDESymbolsUseAbsDiff() const { return DwarfFDESymbolsUseAbsDiff; }
bool useDwarfRegNumForCFI() const { return DwarfRegNumForCFI; }
bool useParensForSymbolVariant() const { return UseParensForSymbolVariant; }
bool useParensForDollarSignNames() const {
return UseParensForDollarSignNames;
}
bool supportsExtendedDwarfLocDirective() const {
return SupportsExtendedDwarfLocDirective;
}

View File

@ -75,9 +75,8 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const {
const MCSymbol &Sym = SRE.getSymbol();
// Parenthesize names that start with $ so that they don't look like
// absolute names.
bool UseParens = MAI && MAI->useParensForDollarSignNames() && !InParens &&
!Sym.getName().empty() && Sym.getName()[0] == '$';
bool UseParens =
!InParens && !Sym.getName().empty() && Sym.getName()[0] == '$';
if (UseParens) {
OS << '(';
Sym.print(OS, MAI);

View File

@ -54,8 +54,4 @@ NVPTXMCAsmInfo::NVPTXMCAsmInfo(const Triple &TheTriple,
GlobalDirective = "\t// .globl\t";
UseIntegratedAssembler = false;
// Avoid using parens for identifiers starting with $ - ptxas does
// not expect them.
UseParensForDollarSignNames = false;
}

View File

@ -1,14 +0,0 @@
; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
; ptxas has no special meaning for '$' character, so it should be used
; without parens.
@"$str" = private addrspace(1) constant [4 x i8] c"str\00"
declare void @str2(i8* %str)
define void @str1() {
entry:
;; CHECK: mov.u64 %rd{{[0-9]+}}, $str;
tail call void @str2(i8* getelementptr ([4 x i8], [4 x i8]* addrspacecast ([4 x i8] addrspace(1)* @"$str" to [4 x i8]*), i64 0, i64 0))
ret void
}