mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-26 13:26:22 +00:00
[BOLT] Enhance fixed indirect branch handling (#71324)
Previously HasFixedIndirectBranch was set in BF to set isSimple to false later because of unreachable bb ellimination pass which might remove the BB with it's symbols accessed by other instructions than calls. It seems to be that better solution would be to add extra entry point on target offset instead of marking BF as non-simple.
This commit is contained in:
parent
291f4a0023
commit
5b59540661
@ -319,10 +319,6 @@ private:
|
||||
/// Execution halts whenever this function is entered.
|
||||
bool TrapsOnEntry{false};
|
||||
|
||||
/// True if the function had an indirect branch with a fixed internal
|
||||
/// destination.
|
||||
bool HasFixedIndirectBranch{false};
|
||||
|
||||
/// True if the function is a fragment of another function. This means that
|
||||
/// this function could only be entered via its parent or one of its sibling
|
||||
/// fragments. It could be entered at any basic block. It can also return
|
||||
|
@ -432,8 +432,6 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) {
|
||||
OS << "\n IsSplit : " << isSplit();
|
||||
OS << "\n BB Count : " << size();
|
||||
|
||||
if (HasFixedIndirectBranch)
|
||||
OS << "\n HasFixedIndirectBranch : true";
|
||||
if (HasUnknownControlFlow)
|
||||
OS << "\n Unknown CF : true";
|
||||
if (getPersonalityFunction())
|
||||
@ -1118,7 +1116,7 @@ void BinaryFunction::handleIndirectBranch(MCInst &Instruction, uint64_t Size,
|
||||
Instruction.clear();
|
||||
MIB->createUncondBranch(Instruction, TargetSymbol, BC.Ctx.get());
|
||||
TakenBranches.emplace_back(Offset, IndirectTarget - getAddress());
|
||||
HasFixedIndirectBranch = true;
|
||||
addEntryPointAtOffset(IndirectTarget - getAddress());
|
||||
} else {
|
||||
MIB->convertJmpToTailCall(Instruction);
|
||||
BC.addInterproceduralReference(this, IndirectTarget);
|
||||
@ -1894,9 +1892,6 @@ bool BinaryFunction::postProcessIndirectBranches(
|
||||
LastIndirectJumpBB->updateJumpTableSuccessors();
|
||||
}
|
||||
|
||||
if (HasFixedIndirectBranch)
|
||||
return false;
|
||||
|
||||
// Validate that all data references to function offsets are claimed by
|
||||
// recognized jump tables. Register externally referenced blocks as entry
|
||||
// points.
|
||||
|
Loading…
x
Reference in New Issue
Block a user