mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 10:01:42 +00:00
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
This commit is contained in:
parent
5d6d30edf8
commit
20c074ee96
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user