[llvm] 20c074e - C] Add option to ARCOptAddrMode to disable the pass and diagnose errors
Mark Schimmel via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 7 09:08:30 PDT 2021
Author: Mark Schimmel
Date: 2021-10-07T09:07:07-07:00
New Revision: 20c074ee969d41aa4af84beaf91b3e19eb0ca639
URL: https://github.com/llvm/llvm-project/commit/20c074ee969d41aa4af84beaf91b3e19eb0ca639
DIFF: https://github.com/llvm/llvm-project/commit/20c074ee969d41aa4af84beaf91b3e19eb0ca639.diff
LOG: C] Add option to ARCOptAddrMode to disable the pass and diagnose errors
Fixed formatting issues reported by clang-format
Differential Revision: https://reviews.llvm.org/D111255
Added:
Modified:
llvm/lib/Target/ARC/ARCOptAddrMode.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARC/ARCOptAddrMode.cpp b/llvm/lib/Target/ARC/ARCOptAddrMode.cpp
index 232a7be2a9f5..4ba8c13a42db 100644
--- a/llvm/lib/Target/ARC/ARCOptAddrMode.cpp
+++ b/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 @@ using namespace llvm;
#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::processBasicBlock(MachineBasicBlock &MBB) {
}
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 ARCOptAddrMode::runOnMachineFunction(MachineFunction &MF) {
bool Changed = false;
for (auto &MBB : MF)
Changed |= processBasicBlock(MBB);
+
+ if (DUMP_AFTER())
+ MF.dump();
+ if (VIEW_AFTER())
+ MF.viewCFG();
return Changed;
}
More information about the llvm-commits
mailing list