[PATCH] D111255: [ARC] Add option to ARCOptAddrMode to disable the pass and diagnose errors

Mark Schimmel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 7 09:08:36 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG20c074ee969d: C] Add option to ARCOptAddrMode to disable the pass and diagnose errors (authored by marksl).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111255/new/

https://reviews.llvm.org/D111255

Files:
  llvm/lib/Target/ARC/ARCOptAddrMode.cpp


Index: llvm/lib/Target/ARC/ARCOptAddrMode.cpp
===================================================================
--- llvm/lib/Target/ARC/ARCOptAddrMode.cpp
+++ llvm/lib/Target/ARC/ARCOptAddrMode.cpp
@@ -23,6 +23,7 @@
 #include "llvm/CodeGen/TargetRegisterInfo.h"
 #include "llvm/IR/Function.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -33,6 +34,16 @@
 #define DEBUG_TYPE "arc-addr-mode"
 
 namespace llvm {
+
+static cl::opt<unsigned> ArcKillAddrMode("arc-kill-addr-mode", cl::init(0),
+                                         cl::ReallyHidden, cl::ZeroOrMore);
+
+#define DUMP_BEFORE() ((ArcKillAddrMode & 0x0001) != 0)
+#define DUMP_AFTER() ((ArcKillAddrMode & 0x0002) != 0)
+#define VIEW_BEFORE() ((ArcKillAddrMode & 0x0004) != 0)
+#define VIEW_AFTER() ((ArcKillAddrMode & 0x0008) != 0)
+#define KILL_PASS() ((ArcKillAddrMode & 0x0010) != 0)
+
 FunctionPass *createARCOptAddrMode();
 void initializeARCOptAddrModePass(PassRegistry &);
 } // end namespace llvm
@@ -485,9 +496,14 @@
 }
 
 bool ARCOptAddrMode::runOnMachineFunction(MachineFunction &MF) {
-  if (skipFunction(MF.getFunction()))
+  if (skipFunction(MF.getFunction()) || KILL_PASS())
     return false;
 
+  if (DUMP_BEFORE())
+    MF.dump();
+  if (VIEW_BEFORE())
+    MF.viewCFG();
+
   AST = &MF.getSubtarget<ARCSubtarget>();
   AII = AST->getInstrInfo();
   MRI = &MF.getRegInfo();
@@ -496,6 +512,11 @@
   bool Changed = false;
   for (auto &MBB : MF)
     Changed |= processBasicBlock(MBB);
+
+  if (DUMP_AFTER())
+    MF.dump();
+  if (VIEW_AFTER())
+    MF.viewCFG();
   return Changed;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111255.377878.patch
Type: text/x-patch
Size: 1676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211007/0f497a8b/attachment.bin>


More information about the llvm-commits mailing list