[llvm] [AVR] Force relocations for non-encodable jumps (PR #121498)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 17:42:23 PST 2025
================
@@ -60,31 +70,37 @@ static void unsigned_width(unsigned Width, uint64_t Value,
Ctx->reportError(Fixup.getLoc(), Diagnostic);
}
+
+ return false;
}
/// Adjusts the value of a branch target before fixup application.
static void adjustBranch(unsigned Size, const MCFixup &Fixup, uint64_t &Value,
MCContext *Ctx) {
// We have one extra bit of precision because the value is rightshifted by
// one.
- unsigned_width(Size + 1, Value, std::string("branch target"), Fixup, Ctx);
+ checkUnsignedWidth(Size + 1, Value, std::string("branch target"), Fixup, Ctx);
// Rightshifts the value by one.
AVR::fixups::adjustBranchTarget(Value);
}
/// Adjusts the value of a relative branch target before fixup application.
-static void adjustRelativeBranch(unsigned Size, const MCFixup &Fixup,
- uint64_t &Value, MCContext *Ctx) {
+static bool adjustRelativeBranch(unsigned Size, const MCFixup &Fixup,
+ uint64_t &Value, MCContext *Ctx,
+ const MCSubtargetInfo *STI = nullptr) {
// Jumps are relative to the current instruction.
Value -= 2;
// We have one extra bit of precision because the value is rightshifted by
// one.
Size += 1;
- if (!isIntN(Size, Value) &&
- Ctx->getSubtargetInfo()->hasFeature(AVR::FeatureWrappingRjmp)) {
+ if (!STI) {
----------------
arsenm wrote:
In no context where there is a branch should the subtarget be uncertain?
https://github.com/llvm/llvm-project/pull/121498
More information about the llvm-commits
mailing list