[PATCH] [mips] [IAS] Factor out .set nomacro warning. NFC.

Toma Tabacu toma.tabacu at imgtec.com
Thu May 14 09:18:46 PDT 2015


Hi dsanders,

http://reviews.llvm.org/D9772

Files:
  lib/Target/Mips/AsmParser/MipsAsmParser.cpp

Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -448,6 +448,8 @@
 
   /// Warn if RegIndex is the same as the current AT.
   void warnIfRegIndexIsAT(unsigned RegIndex, SMLoc Loc);
+
+  void warnIfNoMacro(SMLoc Loc);
 };
 }
 
@@ -1759,8 +1761,7 @@
     tmpInst.addOperand(MCOperand::createImm(ImmValue));
     Instructions.push_back(tmpInst);
   } else if ((ImmValue & 0xffffffff) == ImmValue) {
-    if (!AssemblerOptions.back()->isMacro())
-      Warning(IDLoc, "macro instruction expanded into multiple instructions");
+    warnIfNoMacro(IDLoc);
 
     // For all other values which are representable as a 32-bit integer:
     // li d,j => lui d,hi16(j)
@@ -1782,8 +1783,7 @@
       Error(IDLoc, "instruction requires a 32-bit immediate");
       return true;
     }
-    if (!AssemblerOptions.back()->isMacro())
-      Warning(IDLoc, "macro instruction expanded into multiple instructions");
+    warnIfNoMacro(IDLoc);
 
     //            <-------  lo32 ------>
     // <-------  hi32 ------>
@@ -1817,8 +1817,7 @@
       Error(IDLoc, "instruction requires a 32-bit immediate");
       return true;
     }
-    if (!AssemblerOptions.back()->isMacro())
-      Warning(IDLoc, "macro instruction expanded into multiple instructions");
+    warnIfNoMacro(IDLoc);
 
     // <-------  hi32 ------> <-------  lo32 ------>
     // <- hi16 ->                        <- lo16 ->
@@ -1921,8 +1920,7 @@
 void MipsAsmParser::expandLoadAddressSym(
     const MCOperand &DstRegOp, const MCOperand &SymOp, bool Is32BitSym,
     SMLoc IDLoc, SmallVectorImpl<MCInst> &Instructions) {
-  if (!AssemblerOptions.back()->isMacro())
-    Warning(IDLoc, "macro instruction expanded into multiple instructions");
+  warnIfNoMacro(IDLoc);
 
   if (Is32BitSym && isABI_N64())
     Warning(IDLoc, "instruction loads the 32-bit address of a 64-bit symbol");
@@ -2243,6 +2241,11 @@
                      ") without \".set noat\"");
 }
 
+void MipsAsmParser::warnIfNoMacro(SMLoc Loc) {
+  if (!AssemblerOptions.back()->isMacro())
+    Warning(Loc, "macro instruction expanded into multiple instructions");
+}
+
 void
 MipsAsmParser::printWarningWithFixIt(const Twine &Msg, const Twine &FixMsg,
                                      SMRange Range, bool ShowColors) {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9772.25779.patch
Type: text/x-patch
Size: 2408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150514/cd11f20a/attachment.bin>


More information about the llvm-commits mailing list