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

Anirudh Prasad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 5 10:29:01 PDT 2021


anirudhp created this revision.
Herald added a subscriber: hiraditya.
anirudhp requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

- 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()`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99891

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
@@ -460,6 +460,12 @@
   // 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 @@
 }
 
 bool SystemZAsmParser::isLabel(AsmToken &Token) {
-  if (getMAIAssemblerDialect() == AD_ATT)
+  if (isParsingATT())
     return true;
 
   // HLASM labels are ordinary symbols.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99891.335292.patch
Type: text/x-patch
Size: 982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210405/fed8498a/attachment.bin>


More information about the llvm-commits mailing list