Skip to content

Commit

Permalink
[JITLink][x86-64] Rename BranchPCRel32ToPtrJumpStub(Relaxable -> Bypa…
Browse files Browse the repository at this point in the history
…ssable).

ELF allows for branch optimizations other than bypass, so rename this edge kind
to avoid any confusion.
  • Loading branch information
lhames committed Aug 14, 2021
1 parent 29e11a1 commit 632135a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
9 changes: 5 additions & 4 deletions llvm/include/llvm/ExecutionEngine/JITLink/x86_64.h
Expand Up @@ -132,7 +132,7 @@ enum EdgeKind_x86_64 : Edge::Kind {
/// This edge kind has the same fixup expression as BranchPCRel32, but further
/// identifies the call/branch as being to a pointer jump stub. For edges of
/// this kind the jump stub should not be bypassed (use
/// BranchPCRel32ToPtrJumpStubRelaxable for that), but the pointer location
/// BranchPCRel32ToPtrJumpStubBypassable for that), but the pointer location
/// target may be recorded to allow manipulation at runtime.
///
/// Fixup expression:
Expand All @@ -148,7 +148,8 @@ enum EdgeKind_x86_64 : Edge::Kind {
///
/// The edge kind has the same fixup expression as BranchPCRel32ToPtrJumpStub,
/// but identifies the call/branch as being to a pointer jump stub that may be
/// bypassed if the ultimate target is within range of the fixup location.
/// bypassed with a direct jump to the ultimate target if the ultimate target
/// is within range of the fixup location.
///
/// Fixup expression:
/// Fixup <- Target - Fixup + Addend - 4: int32
Expand All @@ -157,7 +158,7 @@ enum EdgeKind_x86_64 : Edge::Kind {
/// - The result of the fixup expression must fit into an int32, otherwise
/// an out-of-range error will be returned.
///
BranchPCRel32ToPtrJumpStubRelaxable,
BranchPCRel32ToPtrJumpStubBypassable,

/// A GOT entry getter/constructor, transformed to Delta32 pointing at the GOT
/// entry for the original target.
Expand Down Expand Up @@ -338,7 +339,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,

case BranchPCRel32:
case BranchPCRel32ToPtrJumpStub:
case BranchPCRel32ToPtrJumpStubRelaxable:
case BranchPCRel32ToPtrJumpStubBypassable:
case PCRel32GOTLoadRelaxable:
case PCRel32TLVPLoadRelaxable: {
int64_t Value =
Expand Down
9 changes: 4 additions & 5 deletions llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
Expand Up @@ -107,10 +107,9 @@ class PerGraphGOTAndPLTStubsBuilder_ELF_x86_64
void fixPLTEdge(Edge &E, Symbol &Stub) {
assert(E.getKind() == x86_64::BranchPCRel32 && "Not a Branch32 edge?");

// Set the edge kind to Branch32ToStub. We will use this to check for stub
// optimization opportunities in the optimize ELF_x86_64_GOTAndStubs pass
// below.
E.setKind(x86_64::BranchPCRel32ToPtrJumpStubRelaxable);
// Set the edge kind to Branch32ToPtrJumpStubRelaxable to enable it to be
// optimized when the target is in-range.
E.setKind(x86_64::BranchPCRel32ToPtrJumpStubBypassable);
E.setTarget(Stub);
}

Expand Down Expand Up @@ -191,7 +190,7 @@ static Error optimizeELF_x86_64_GOTAndStubs(LinkGraph &G) {
dbgs() << "\n";
});
}
} else if (E.getKind() == x86_64::BranchPCRel32ToPtrJumpStubRelaxable) {
} else if (E.getKind() == x86_64::BranchPCRel32ToPtrJumpStubBypassable) {
auto &StubBlock = E.getTarget().getBlock();
assert(
StubBlock.getSize() ==
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
Expand Up @@ -466,10 +466,10 @@ class PerGraphGOTAndPLTStubsBuilder_MachO_x86_64
assert(E.getAddend() == 0 &&
"BranchPCRel32 edge has unexpected addend value");

// Set the edge kind to BranchPCRel32ToPtrJumpStubRelaxable. We will use
// Set the edge kind to BranchPCRel32ToPtrJumpStubBypassable. We will use
// this to check for stub optimization opportunities in the
// optimizeMachO_x86_64_GOTAndStubs pass below.
E.setKind(x86_64::BranchPCRel32ToPtrJumpStubRelaxable);
E.setKind(x86_64::BranchPCRel32ToPtrJumpStubBypassable);
E.setTarget(Stub);
}

Expand Down Expand Up @@ -535,7 +535,7 @@ static Error optimizeMachO_x86_64_GOTAndStubs(LinkGraph &G) {
dbgs() << "\n";
});
}
} else if (E.getKind() == x86_64::BranchPCRel32ToPtrJumpStubRelaxable) {
} else if (E.getKind() == x86_64::BranchPCRel32ToPtrJumpStubBypassable) {
auto &StubBlock = E.getTarget().getBlock();
assert(StubBlock.getSize() == sizeof(x86_64::PointerJumpStubContent) &&
"Stub block should be stub sized");
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ExecutionEngine/JITLink/x86_64.cpp
Expand Up @@ -38,8 +38,8 @@ const char *getEdgeKindName(Edge::Kind K) {
return "BranchPCRel32";
case BranchPCRel32ToPtrJumpStub:
return "BranchPCRel32ToPtrJumpStub";
case BranchPCRel32ToPtrJumpStubRelaxable:
return "BranchPCRel32ToPtrJumpStubRelaxable";
case BranchPCRel32ToPtrJumpStubBypassable:
return "BranchPCRel32ToPtrJumpStubBypassable";
case RequestGOTAndTransformToDelta32:
return "RequestGOTAndTransformToDelta32";
case RequestGOTAndTransformToDelta64:
Expand Down

0 comments on commit 632135a

Please sign in to comment.