mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 13:50:11 +00:00
[BOLT] Refactor --keep-nops option. NFC. (#72228)
Run RemoveNops pass only if --keep-nops is set to false (default).
This commit is contained in:
parent
b7669ed95f
commit
e823136d43
@ -1296,7 +1296,7 @@ public:
|
||||
/// Return true if the function body is non-contiguous.
|
||||
bool isSplit() const { return isSimple() && getLayout().isSplit(); }
|
||||
|
||||
bool shouldPreserveNops() const;
|
||||
bool shouldPreserveNops() const { return PreserveNops; }
|
||||
|
||||
/// Return true if the function has exception handling tables.
|
||||
bool hasEHRanges() const { return HasEHRanges; }
|
||||
|
@ -4367,10 +4367,6 @@ MCInst *BinaryFunction::getInstructionAtOffset(uint64_t Offset) {
|
||||
}
|
||||
}
|
||||
|
||||
bool BinaryFunction::shouldPreserveNops() const {
|
||||
return PreserveNops || opts::KeepNops;
|
||||
}
|
||||
|
||||
void BinaryFunction::printLoopInfo(raw_ostream &OS) const {
|
||||
if (!opts::shouldPrint(*this))
|
||||
return;
|
||||
|
@ -72,6 +72,11 @@ static cl::opt<bool> JTFootprintReductionFlag(
|
||||
"instructions at jump sites"),
|
||||
cl::cat(BoltOptCategory));
|
||||
|
||||
static cl::opt<bool>
|
||||
KeepNops("keep-nops",
|
||||
cl::desc("keep no-op instructions. By default they are removed."),
|
||||
cl::Hidden, cl::cat(BoltOptCategory));
|
||||
|
||||
cl::opt<bool> NeverPrint("never-print", cl::desc("never print"),
|
||||
cl::ReallyHidden, cl::cat(BoltOptCategory));
|
||||
|
||||
@ -359,7 +364,8 @@ void BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
|
||||
|
||||
Manager.registerPass(std::make_unique<ShortenInstructions>(NeverPrint));
|
||||
|
||||
Manager.registerPass(std::make_unique<RemoveNops>(NeverPrint));
|
||||
Manager.registerPass(std::make_unique<RemoveNops>(NeverPrint),
|
||||
!opts::KeepNops);
|
||||
|
||||
Manager.registerPass(std::make_unique<NormalizeCFG>(PrintNormalized));
|
||||
|
||||
|
@ -129,11 +129,6 @@ cl::opt<bool>
|
||||
cl::desc("instrument code to generate accurate profile data"),
|
||||
cl::cat(BoltOptCategory));
|
||||
|
||||
cl::opt<bool>
|
||||
KeepNops("keep-nops",
|
||||
cl::desc("keep no-op instructions. By default they are removed."),
|
||||
cl::Hidden, cl::cat(BoltOptCategory));
|
||||
|
||||
cl::opt<std::string>
|
||||
OutputFilename("o",
|
||||
cl::desc("<output file>"),
|
||||
|
Loading…
Reference in New Issue
Block a user