[llvm] 7da22df - [SystemZ][z/OS] Introduce dialect querying helper functions

Anirudh Prasad via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 09:14:42 PDT 2021


Author: Anirudh Prasad
Date: 2021-04-13T12:14:34-04:00
New Revision: 7da22dfcd06a2df056f10913dccae8f6b28f79ef

URL: https://github.com/llvm/llvm-project/commit/7da22dfcd06a2df056f10913dccae8f6b28f79ef
DIFF: https://github.com/llvm/llvm-project/commit/7da22dfcd06a2df056f10913dccae8f6b28f79ef.diff

LOG: [SystemZ][z/OS] Introduce dialect querying helper functions

- In the SystemZAsmParser, there will be a few queries to the type of dialect it is (AD_ATT, AD_HLASM) in future patches.
- It would be nice to have two small helper functions `isParsingATT()` and `isParsingHLASM()`
- Putting this as a separate smaller patch allows us to remove its definitions from other dependent patches.

Reviewed By: uweigand, abhina.sreeskantharajan

Differential Revision: https://reviews.llvm.org/D99891

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp b/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
index c600842c7f447..ef6ba28718151 100644
--- a/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
+++ b/llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
@@ -460,6 +460,12 @@ class SystemZAsmParser : public MCTargetAsmParser {
   // A digit in HLASM is a number from 0 to 9.
   inline bool isHLASMAlnum(char C) { return isHLASMAlpha(C) || isDigit(C); }
 
+  // Are we parsing using the AD_HLASM dialect?
+  inline bool isParsingHLASM() { return getMAIAssemblerDialect() == AD_HLASM; }
+
+  // Are we parsing using the AD_ATT dialect?
+  inline bool isParsingATT() { return getMAIAssemblerDialect() == AD_ATT; }
+
 public:
   SystemZAsmParser(const MCSubtargetInfo &sti, MCAsmParser &parser,
                    const MCInstrInfo &MII,
@@ -1606,7 +1612,7 @@ SystemZAsmParser::parsePCRel(OperandVector &Operands, int64_t MinVal,
 }
 
 bool SystemZAsmParser::isLabel(AsmToken &Token) {
-  if (getMAIAssemblerDialect() == AD_ATT)
+  if (isParsingATT())
     return true;
 
   // HLASM labels are ordinary symbols.


        


More information about the llvm-commits mailing list