@@ -91,21 +91,21 @@ class TrackedRegisters {
91
91
const std::vector<MCPhysReg> Registers;
92
92
std::vector<uint16_t > RegToIndexMapping;
93
93
94
- static size_t getMappingSize (const ArrayRef<MCPhysReg> RegsToTrack) {
94
+ static size_t getMappingSize (ArrayRef<MCPhysReg> RegsToTrack) {
95
95
if (RegsToTrack.empty ())
96
96
return 0 ;
97
97
return 1 + *llvm::max_element (RegsToTrack);
98
98
}
99
99
100
100
public:
101
- TrackedRegisters (const ArrayRef<MCPhysReg> RegsToTrack)
101
+ TrackedRegisters (ArrayRef<MCPhysReg> RegsToTrack)
102
102
: Registers(RegsToTrack),
103
103
RegToIndexMapping (getMappingSize(RegsToTrack), NoIndex) {
104
104
for (unsigned I = 0 ; I < RegsToTrack.size (); ++I)
105
105
RegToIndexMapping[RegsToTrack[I]] = I;
106
106
}
107
107
108
- const ArrayRef<MCPhysReg> getRegisters () const { return Registers; }
108
+ ArrayRef<MCPhysReg> getRegisters () const { return Registers; }
109
109
110
110
size_t getNumTrackedRegisters () const { return Registers.size (); }
111
111
@@ -232,9 +232,9 @@ struct SrcState {
232
232
bool operator !=(const SrcState &RHS) const { return !((*this ) == RHS); }
233
233
};
234
234
235
- static void printLastInsts (
236
- raw_ostream &OS,
237
- const ArrayRef<SmallPtrSet<const MCInst *, 4 >> LastInstWritingReg) {
235
+ static void
236
+ printLastInsts ( raw_ostream &OS,
237
+ ArrayRef<SmallPtrSet<const MCInst *, 4 >> LastInstWritingReg) {
238
238
OS << " Insts: " ;
239
239
for (unsigned I = 0 ; I < LastInstWritingReg.size (); ++I) {
240
240
auto &Set = LastInstWritingReg[I];
@@ -294,16 +294,15 @@ void SrcStatePrinter::print(raw_ostream &OS, const SrcState &S) const {
294
294
// / version for functions without reconstructed CFG.
295
295
class SrcSafetyAnalysis {
296
296
public:
297
- SrcSafetyAnalysis (BinaryFunction &BF,
298
- const ArrayRef<MCPhysReg> RegsToTrackInstsFor)
297
+ SrcSafetyAnalysis (BinaryFunction &BF, ArrayRef<MCPhysReg> RegsToTrackInstsFor)
299
298
: BC(BF.getBinaryContext()), NumRegs(BC.MRI->getNumRegs ()),
300
299
RegsToTrackInstsFor(RegsToTrackInstsFor) {}
301
300
302
301
virtual ~SrcSafetyAnalysis () {}
303
302
304
303
static std::shared_ptr<SrcSafetyAnalysis>
305
304
create (BinaryFunction &BF, MCPlusBuilder::AllocatorIdTy AllocId,
306
- const ArrayRef<MCPhysReg> RegsToTrackInstsFor);
305
+ ArrayRef<MCPhysReg> RegsToTrackInstsFor);
307
306
308
307
virtual void run () = 0;
309
308
virtual const SrcState &getStateBefore (const MCInst &Inst) const = 0;
@@ -518,7 +517,7 @@ class SrcSafetyAnalysis {
518
517
public:
519
518
std::vector<MCInstReference>
520
519
getLastClobberingInsts (const MCInst &Inst, BinaryFunction &BF,
521
- const ArrayRef<MCPhysReg> UsedDirtyRegs) const {
520
+ ArrayRef<MCPhysReg> UsedDirtyRegs) const {
522
521
if (RegsToTrackInstsFor.empty ())
523
522
return {};
524
523
const SrcState &S = getStateBefore (Inst);
@@ -552,7 +551,7 @@ class DataflowSrcSafetyAnalysis
552
551
public:
553
552
DataflowSrcSafetyAnalysis (BinaryFunction &BF,
554
553
MCPlusBuilder::AllocatorIdTy AllocId,
555
- const ArrayRef<MCPhysReg> RegsToTrackInstsFor)
554
+ ArrayRef<MCPhysReg> RegsToTrackInstsFor)
556
555
: SrcSafetyAnalysis(BF, RegsToTrackInstsFor), DFParent(BF, AllocId) {}
557
556
558
557
const SrcState &getStateBefore (const MCInst &Inst) const override {
@@ -669,7 +668,7 @@ class CFGUnawareSrcSafetyAnalysis : public SrcSafetyAnalysis {
669
668
public:
670
669
CFGUnawareSrcSafetyAnalysis (BinaryFunction &BF,
671
670
MCPlusBuilder::AllocatorIdTy AllocId,
672
- const ArrayRef<MCPhysReg> RegsToTrackInstsFor)
671
+ ArrayRef<MCPhysReg> RegsToTrackInstsFor)
673
672
: SrcSafetyAnalysis(BF, RegsToTrackInstsFor), BF(BF), AllocId(AllocId) {
674
673
StateAnnotationIndex =
675
674
BC.MIB ->getOrCreateAnnotationIndex (" CFGUnawareSrcSafetyAnalysis" );
@@ -713,7 +712,7 @@ class CFGUnawareSrcSafetyAnalysis : public SrcSafetyAnalysis {
713
712
std::shared_ptr<SrcSafetyAnalysis>
714
713
SrcSafetyAnalysis::create (BinaryFunction &BF,
715
714
MCPlusBuilder::AllocatorIdTy AllocId,
716
- const ArrayRef<MCPhysReg> RegsToTrackInstsFor) {
715
+ ArrayRef<MCPhysReg> RegsToTrackInstsFor) {
717
716
if (BF.hasCFG ())
718
717
return std::make_shared<DataflowSrcSafetyAnalysis>(BF, AllocId,
719
718
RegsToTrackInstsFor);
0 commit comments