1414#include " bolt/Passes/InsertNegateRAStatePass.h"
1515#include " bolt/Core/BinaryFunction.h"
1616#include " bolt/Core/ParallelUtilities.h"
17- #include " bolt/Utils/CommandLineOpts.h"
1817#include < cstdlib>
19- #include < fstream>
20- #include < iterator>
2118
2219using namespace llvm ;
2320
@@ -38,10 +35,10 @@ void InsertNegateRAState::runOnFunction(BinaryFunction &BF) {
3835 }
3936
4037 // If none is inserted, the function doesn't need more work.
41- if (!addNegateRAStateAfterPacOrAuth (BF))
38+ if (!addNegateRAStateAfterPSignOrPAuth (BF))
4239 return ;
4340
44- fixUnknownStates (BF);
41+ inferUnknownStates (BF);
4542
4643 // Support for function splitting:
4744 // if two consecutive BBs with Signed state are going to end up in different
@@ -53,7 +50,7 @@ void InsertNegateRAState::runOnFunction(BinaryFunction &BF) {
5350 // BOLT can generate empty BBs at function splitting which are only used as
5451 // target labels. We should add the negate-ra-state CFI to the first
5552 // non-empty BB.
56- auto FirstNonEmpty =
53+ auto * FirstNonEmpty =
5754 std::find_if (FF.begin (), FF.end (), [](BinaryBasicBlock *BB) {
5855 // getFirstNonPseudo returns BB.end() if it does not find any
5956 // Instructions.
@@ -92,7 +89,8 @@ void InsertNegateRAState::runOnFunction(BinaryFunction &BF) {
9289 }
9390}
9491
95- bool InsertNegateRAState::addNegateRAStateAfterPacOrAuth (BinaryFunction &BF) {
92+ bool InsertNegateRAState::addNegateRAStateAfterPSignOrPAuth (
93+ BinaryFunction &BF) {
9694 BinaryContext &BC = BF.getBinaryContext ();
9795 bool FoundAny = false ;
9896 for (BinaryBasicBlock &BB : BF) {
@@ -109,7 +107,7 @@ bool InsertNegateRAState::addNegateRAStateAfterPacOrAuth(BinaryFunction &BF) {
109107 return FoundAny;
110108}
111109
112- void InsertNegateRAState::fixUnknownStates (BinaryFunction &BF) {
110+ void InsertNegateRAState::inferUnknownStates (BinaryFunction &BF) {
113111 BinaryContext &BC = BF.getBinaryContext ();
114112 bool FirstIter = true ;
115113 MCInst PrevInst;
0 commit comments