Skip to content

Commit 783901b

Browse files
tltaoTony Tao
and
Tony Tao
authored
[SystemZ] Rename SystemZ ATT Asm dialect to GNU Asm dialect (#112800)
The ATT assembler dialect on SystemZ seems to have been taken from the existing ATT/Intel code. However, on SystemZ, ATT does not hold any meaning. In reality, we are splitting the difference between GNU Asm syntax and HLASM Asm syntax, so it makes sense to rename ATT to GNU instead. Co-authored-by: Tony Tao <[email protected]>
1 parent 803220d commit 783901b

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ class SystemZAsmParser : public MCTargetAsmParser {
442442

443443
bool parseOperand(OperandVector &Operands, StringRef Mnemonic);
444444

445-
// Both the hlasm and att variants still rely on the basic gnu asm
445+
// Both the hlasm and gnu variants still rely on the basic gnu asm
446446
// format with respect to inputs, clobbers, outputs etc.
447447
//
448448
// However, calling the overriden getAssemblerDialect() method in
@@ -475,8 +475,8 @@ class SystemZAsmParser : public MCTargetAsmParser {
475475
// Are we parsing using the AD_HLASM dialect?
476476
inline bool isParsingHLASM() { return getMAIAssemblerDialect() == AD_HLASM; }
477477

478-
// Are we parsing using the AD_ATT dialect?
479-
inline bool isParsingATT() { return getMAIAssemblerDialect() == AD_ATT; }
478+
// Are we parsing using the AD_GNU dialect?
479+
inline bool isParsingGNU() { return getMAIAssemblerDialect() == AD_GNU; }
480480

481481
public:
482482
SystemZAsmParser(const MCSubtargetInfo &sti, MCAsmParser &parser,
@@ -848,7 +848,7 @@ ParseStatus SystemZAsmParser::parseRegister(OperandVector &Operands,
848848
}
849849

850850
// Handle register names of the form %<prefix><number>
851-
if (isParsingATT() && Parser.getTok().is(AsmToken::Percent)) {
851+
if (isParsingGNU() && Parser.getTok().is(AsmToken::Percent)) {
852852
if (parseRegister(Reg, /*RequirePercent=*/true))
853853
return ParseStatus::Failure;
854854

@@ -1029,7 +1029,7 @@ bool SystemZAsmParser::parseAddress(bool &HaveReg1, Register &Reg1,
10291029
if (getLexer().is(AsmToken::LParen)) {
10301030
Parser.Lex();
10311031

1032-
if (isParsingATT() && getLexer().is(AsmToken::Percent)) {
1032+
if (isParsingGNU() && getLexer().is(AsmToken::Percent)) {
10331033
// Parse the first register.
10341034
HaveReg1 = true;
10351035
if (parseRegister(Reg1, /*RequirePercent=*/true))
@@ -1072,7 +1072,7 @@ bool SystemZAsmParser::parseAddress(bool &HaveReg1, Register &Reg1,
10721072
if (parseIntegerRegister(Reg2, RegGR))
10731073
return true;
10741074
} else {
1075-
if (isParsingATT() && parseRegister(Reg2, /*RequirePercent=*/true))
1075+
if (isParsingGNU() && parseRegister(Reg2, /*RequirePercent=*/true))
10761076
return true;
10771077
}
10781078
}
@@ -1490,7 +1490,7 @@ bool SystemZAsmParser::parseOperand(OperandVector &Operands,
14901490
// a context-dependent parse routine, which gives the required register
14911491
// class. The code is here to mop up other cases, like those where
14921492
// the instruction isn't recognized.
1493-
if (isParsingATT() && Parser.getTok().is(AsmToken::Percent)) {
1493+
if (isParsingGNU() && Parser.getTok().is(AsmToken::Percent)) {
14941494
Register Reg;
14951495
if (parseRegister(Reg, /*RequirePercent=*/true))
14961496
return true;
@@ -1672,7 +1672,7 @@ ParseStatus SystemZAsmParser::parsePCRel(OperandVector &Operands,
16721672
}
16731673

16741674
bool SystemZAsmParser::isLabel(AsmToken &Token) {
1675-
if (isParsingATT())
1675+
if (isParsingGNU())
16761676
return true;
16771677

16781678
// HLASM labels are ordinary symbols.

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
using namespace llvm;
1414

1515
SystemZMCAsmInfoELF::SystemZMCAsmInfoELF(const Triple &TT) {
16-
AssemblerDialect = AD_ATT;
16+
AssemblerDialect = AD_GNU;
1717
CalleeSaveStackSlotSize = 8;
1818
CodePointerSize = 8;
1919
Data64bitsDirective = "\t.quad\t";

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace llvm {
1717
class Triple;
18-
enum SystemZAsmDialect { AD_ATT = 0, AD_HLASM = 1 };
18+
enum SystemZAsmDialect { AD_GNU = 0, AD_HLASM = 1 };
1919

2020
class SystemZMCAsmInfoELF : public MCAsmInfoELF {
2121
public:

llvm/lib/Target/SystemZ/SystemZ.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def SystemZAsmParser : AsmParser {
6767
let ShouldEmitMatchRegisterName = 0;
6868
}
6969

70-
def ATTAsmParserVariant : AsmParserVariant {
70+
def GNUAsmParserVariant : AsmParserVariant {
7171
int Variant = 0;
7272

7373
// Variant name.
74-
string Name = "att";
74+
string Name = "gnu";
7575
}
7676

7777
def HLASMAsmParserVariant : AsmParserVariant {
@@ -88,6 +88,6 @@ def HLASMAsmParserVariant : AsmParserVariant {
8888
def SystemZ : Target {
8989
let InstructionSet = SystemZInstrInfo;
9090
let AssemblyParsers = [SystemZAsmParser];
91-
let AssemblyParserVariants = [ATTAsmParserVariant, HLASMAsmParserVariant];
91+
let AssemblyParserVariants = [GNUAsmParserVariant, HLASMAsmParserVariant];
9292
let AllowRegisterRenaming = 1;
9393
}

llvm/lib/Target/SystemZ/SystemZInstrFormats.td

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein,
20502050
bit alternate = alternatein;
20512051

20522052
// Whether this needs be to restricted to a specific dialect.
2053-
// Valid values are "att" and "hlasm", which when passed in
2053+
// Valid values are "gnu" and "hlasm", which when passed in
20542054
// will set AsmVariantName.
20552055
string asmvariant = asmvariantin;
20562056
}
@@ -2063,20 +2063,20 @@ def CondAlways : CondVariant<15, "", 0>;
20632063
def CondVariantO : CondVariant<1, "o", 0>;
20642064
def CondVariantH : CondVariant<2, "h", 0>;
20652065
def CondVariantP : CondVariant<2, "p", 1>;
2066-
def CondVariantNLE : CondVariant<3, "nle", 0, "att">;
2066+
def CondVariantNLE : CondVariant<3, "nle", 0, "gnu">;
20672067
def CondVariantL : CondVariant<4, "l", 0>;
20682068
def CondVariantM : CondVariant<4, "m", 1>;
2069-
def CondVariantNHE : CondVariant<5, "nhe", 0, "att">;
2070-
def CondVariantLH : CondVariant<6, "lh", 0, "att">;
2069+
def CondVariantNHE : CondVariant<5, "nhe", 0, "gnu">;
2070+
def CondVariantLH : CondVariant<6, "lh", 0, "gnu">;
20712071
def CondVariantNE : CondVariant<7, "ne", 0>;
20722072
def CondVariantNZ : CondVariant<7, "nz", 1>;
20732073
def CondVariantE : CondVariant<8, "e", 0>;
20742074
def CondVariantZ : CondVariant<8, "z", 1>;
2075-
def CondVariantNLH : CondVariant<9, "nlh", 0, "att">;
2076-
def CondVariantHE : CondVariant<10, "he", 0, "att">;
2075+
def CondVariantNLH : CondVariant<9, "nlh", 0, "gnu">;
2076+
def CondVariantHE : CondVariant<10, "he", 0, "gnu">;
20772077
def CondVariantNL : CondVariant<11, "nl", 0>;
20782078
def CondVariantNM : CondVariant<11, "nm", 1>;
2079-
def CondVariantLE : CondVariant<12, "le", 0, "att">;
2079+
def CondVariantLE : CondVariant<12, "le", 0, "gnu">;
20802080
def CondVariantNH : CondVariant<13, "nh", 0>;
20812081
def CondVariantNP : CondVariant<13, "np", 1>;
20822082
def CondVariantNO : CondVariant<14, "no", 0>;
@@ -2093,16 +2093,16 @@ class CV<string name>
20932093
// and that the low bit of the mask is therefore always 0. This means
20942094
// that each condition has two names. Conditions "o" and "no" are not used.
20952095
def IntCondVariantH : CondVariant<2, "h", 0>;
2096-
def IntCondVariantNLE : CondVariant<2, "nle", 1, "att">;
2096+
def IntCondVariantNLE : CondVariant<2, "nle", 1, "gnu">;
20972097
def IntCondVariantL : CondVariant<4, "l", 0>;
2098-
def IntCondVariantNHE : CondVariant<4, "nhe", 1, "att">;
2099-
def IntCondVariantLH : CondVariant<6, "lh", 0, "att">;
2098+
def IntCondVariantNHE : CondVariant<4, "nhe", 1, "gnu">;
2099+
def IntCondVariantLH : CondVariant<6, "lh", 0, "gnu">;
21002100
def IntCondVariantNE : CondVariant<6, "ne", 1>;
21012101
def IntCondVariantE : CondVariant<8, "e", 0>;
2102-
def IntCondVariantNLH : CondVariant<8, "nlh", 1, "att">;
2103-
def IntCondVariantHE : CondVariant<10, "he", 0, "att">;
2102+
def IntCondVariantNLH : CondVariant<8, "nlh", 1, "gnu">;
2103+
def IntCondVariantHE : CondVariant<10, "he", 0, "gnu">;
21042104
def IntCondVariantNL : CondVariant<10, "nl", 1>;
2105-
def IntCondVariantLE : CondVariant<12, "le", 0, "att">;
2105+
def IntCondVariantLE : CondVariant<12, "le", 0, "gnu">;
21062106
def IntCondVariantNH : CondVariant<12, "nh", 1>;
21072107

21082108
// A helper class to look up one of the above by name.

llvm/lib/Target/SystemZ/SystemZInstrInfo.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def NOPR_bare : InstAlias<"nopr", (NOPR R0D), 0>;
121121
def JNOP : InstAlias<"jnop\t$RI2", (BRCAsm 0, brtarget16:$RI2), 0>;
122122

123123
// An alias of BRCL 0, label
124-
// jgnop on att ; jlnop on hlasm
124+
// jgnop on gnu ; jlnop on hlasm
125125
def JGNOP : InstAlias<"{jgnop|jlnop}\t$RI2", (BRCLAsm 0, brtarget32:$RI2), 0>;
126126

127127
// Fused compare-and-branch instructions.
@@ -2351,12 +2351,12 @@ def JXHG : MnemonicAlias<"jxhg", "brxhg">;
23512351
def JXLEG : MnemonicAlias<"jxleg", "brxlg">;
23522352

23532353
def BRU : MnemonicAlias<"bru", "j">;
2354-
def BRUL : MnemonicAlias<"brul", "jg", "att">;
2354+
def BRUL : MnemonicAlias<"brul", "jg", "gnu">;
23552355
def BRUL_HLASM : MnemonicAlias<"brul", "jlu", "hlasm">;
23562356

23572357
foreach V = [ "E", "NE", "H", "NH", "L", "NL", "HE", "NHE", "LE", "NLE",
23582358
"Z", "NZ", "P", "NP", "M", "NM", "LH", "NLH", "O", "NO" ] in {
23592359
defm BRUAsm#V : MnemonicCondBranchAlias <CV<V>, "br#", "j#">;
2360-
defm BRULAsm#V : MnemonicCondBranchAlias <CV<V>, "br#l", "jg#", "att">;
2360+
defm BRULAsm#V : MnemonicCondBranchAlias <CV<V>, "br#l", "jg#", "gnu">;
23612361
defm BRUL_HLASMAsm#V : MnemonicCondBranchAlias <CV<V>, "br#l", "jl#", "hlasm">;
23622362
}

0 commit comments

Comments
 (0)