[PATCH] D101665: [SystemZ][z/OS] Enforce prefix-less registers in SystemZAsmParser for the HLASM dialect.
Anirudh Prasad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 30 14:12:14 PDT 2021
anirudhp created this revision.
anirudhp added reviewers: Kai, yusra.syeda, neumannh, uweigand, abhina.sreeskantharajan.
Herald added a subscriber: hiraditya.
anirudhp requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
- Previously, https://reviews.llvm.org/D101308 removed prefixes from register while printing them out. This was especially needed for inline asm statements which used input/output operands.
- However, the backend SystemZAsmParser, accepts both prefixed registers and prefix-less registers as part of its implementation
- This patch aims to change that by ensuring that prefixed registers are only allowed for the ATT dialect.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101665
Files:
llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
Index: llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
===================================================================
--- llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
+++ llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
@@ -830,7 +830,7 @@
}
// Handle register names of the form %<prefix><number>
- if (Parser.getTok().is(AsmToken::Percent)) {
+ if (isParsingATT() && Parser.getTok().is(AsmToken::Percent)) {
if (parseRegister(Reg))
return MatchOperand_ParseFail;
@@ -912,6 +912,9 @@
Operands.push_back(SystemZOperand::createImm(Register, StartLoc, EndLoc));
}
else {
+ if (isParsingHLASM())
+ return MatchOperand_NoMatch;
+
Register Reg;
if (parseRegister(Reg))
return MatchOperand_ParseFail;
@@ -1019,7 +1022,7 @@
if (getLexer().is(AsmToken::LParen)) {
Parser.Lex();
- if (getLexer().is(AsmToken::Percent)) {
+ if (isParsingATT() && getLexer().is(AsmToken::Percent)) {
// Parse the first register.
HaveReg1 = true;
if (parseRegister(Reg1))
@@ -1062,7 +1065,7 @@
if (parseIntegerRegister(Reg2, RegGR))
return true;
} else {
- if (parseRegister(Reg2))
+ if (isParsingATT() && parseRegister(Reg2))
return true;
}
}
@@ -1419,7 +1422,7 @@
// a context-dependent parse routine, which gives the required register
// class. The code is here to mop up other cases, like those where
// the instruction isn't recognized.
- if (Parser.getTok().is(AsmToken::Percent)) {
+ if (isParsingATT() && Parser.getTok().is(AsmToken::Percent)) {
Register Reg;
if (parseRegister(Reg))
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101665.342032.patch
Type: text/x-patch
Size: 1693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210430/d7d90fe3/attachment.bin>
More information about the llvm-commits
mailing list