Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 0 additions & 228 deletions bolt/docs/PacRetDesign.md

This file was deleted.

56 changes: 0 additions & 56 deletions bolt/include/bolt/Core/BinaryFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ class BinaryFunction {
PF_MEMEVENT = 4, /// Profile has mem events.
};

void setContainedNegateRAState() { HadNegateRAState = true; }
bool containedNegateRAState() const { return HadNegateRAState; }
void setInitialRAState(bool State) { InitialRAState = State; }
bool getInitialRAState() { return InitialRAState; }

/// Struct for tracking exception handling ranges.
struct CallSite {
const MCSymbol *Start;
Expand Down Expand Up @@ -223,12 +218,6 @@ class BinaryFunction {
/// Current state of the function.
State CurrentState{State::Empty};

/// Indicates if the Function contained .cfi-negate-ra-state. These are not
/// read from the binary. This boolean is used when deciding to run the
/// .cfi-negate-ra-state rewriting passes on a function or not.
bool HadNegateRAState{false};
bool InitialRAState{false};

/// A list of symbols associated with the function entry point.
///
/// Multiple symbols would typically result from identical code-folding
Expand Down Expand Up @@ -1651,51 +1640,6 @@ class BinaryFunction {

void setHasInferredProfile(bool Inferred) { HasInferredProfile = Inferred; }

/// Find corrected offset the same way addCFIInstruction does it to skip NOPs.
std::optional<uint64_t> getCorrectedCFIOffset(uint64_t Offset) {
assert(!Instructions.empty());
auto I = Instructions.lower_bound(Offset);
if (Offset == getSize()) {
assert(I == Instructions.end() && "unexpected iterator value");
// Sometimes compiler issues restore_state after all instructions
// in the function (even after nop).
--I;
Offset = I->first;
}
assert(I->first == Offset && "CFI pointing to unknown instruction");
if (I == Instructions.begin())
return {};

--I;
while (I != Instructions.begin() && BC.MIB->isNoop(I->second)) {
Offset = I->first;
--I;
}
return Offset;
}

void setInstModifiesRAState(uint8_t CFIOpcode, uint64_t Offset) {
std::optional<uint64_t> CorrectedOffset = getCorrectedCFIOffset(Offset);
if (CorrectedOffset) {
auto I = Instructions.lower_bound(*CorrectedOffset);
I--;

switch (CFIOpcode) {
case dwarf::DW_CFA_AARCH64_negate_ra_state:
BC.MIB->setNegateRAState(I->second);
break;
case dwarf::DW_CFA_remember_state:
BC.MIB->setRememberState(I->second);
break;
case dwarf::DW_CFA_restore_state:
BC.MIB->setRestoreState(I->second);
break;
default:
assert(0 && "CFI Opcode not covered by function");
}
}
}

void addCFIInstruction(uint64_t Offset, MCCFIInstruction &&Inst) {
assert(!Instructions.empty());

Expand Down
7 changes: 1 addition & 6 deletions bolt/include/bolt/Core/MCPlus.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@ class MCAnnotation {
kLabel, /// MCSymbol pointing to this instruction.
kSize, /// Size of the instruction.
kDynamicBranch, /// Jit instruction patched at runtime.
kRASigned, /// Inst is in a range where RA is signed.
kRAUnsigned, /// Inst is in a range where RA is unsigned.
kRememberState, /// Inst has rememberState CFI.
kRestoreState, /// Inst has restoreState CFI.
kNegateState, /// Inst has OpNegateRAState CFI.
kGeneric, /// First generic annotation.
kGeneric /// First generic annotation.
};

virtual void print(raw_ostream &OS) const = 0;
Expand Down
Loading
Loading