mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-19 19:31:50 +00:00
ARM: allow vanilla expressions for movw/movt.
Expressions for movw/movt don't always have an :upper16: or :lower16: on them and that's ok. When they don't, it's just a plain [0-65536] immediate result, effectively the same as a :lower16: variant kind. rdar://10550147 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
66413b61f0
commit
94b590f8fa
@ -861,11 +861,11 @@ ARMMCCodeEmitter::getHiLo16ImmOpValue(const MCInst &MI, unsigned OpIdx,
|
||||
|
||||
// Handle :upper16: and :lower16: assembly prefixes.
|
||||
const MCExpr *E = MO.getExpr();
|
||||
MCFixupKind Kind;
|
||||
if (E->getKind() == MCExpr::Target) {
|
||||
const ARMMCExpr *ARM16Expr = cast<ARMMCExpr>(E);
|
||||
E = ARM16Expr->getSubExpr();
|
||||
|
||||
MCFixupKind Kind;
|
||||
switch (ARM16Expr->getKind()) {
|
||||
default: llvm_unreachable("Unsupported ARMFixup");
|
||||
case ARMMCExpr::VK_ARM_HI16:
|
||||
@ -891,9 +891,21 @@ ARMMCCodeEmitter::getHiLo16ImmOpValue(const MCInst &MI, unsigned OpIdx,
|
||||
}
|
||||
Fixups.push_back(MCFixup::Create(0, E, Kind, MI.getLoc()));
|
||||
return 0;
|
||||
};
|
||||
|
||||
llvm_unreachable("Unsupported MCExpr type in MCOperand!");
|
||||
}
|
||||
// If the expression doesn't have :upper16: or :lower16: on it,
|
||||
// it's just a plain immediate expression, and those evaluate to
|
||||
// the lower 16 bits of the expression regardless of whether
|
||||
// we have a movt or a movw.
|
||||
if (!isTargetDarwin() && EvaluateAsPCRel(E))
|
||||
Kind = MCFixupKind(isThumb2()
|
||||
? ARM::fixup_t2_movw_lo16_pcrel
|
||||
: ARM::fixup_arm_movw_lo16_pcrel);
|
||||
else
|
||||
Kind = MCFixupKind(isThumb2()
|
||||
? ARM::fixup_t2_movw_lo16
|
||||
: ARM::fixup_arm_movw_lo16);
|
||||
Fixups.push_back(MCFixup::Create(0, E, Kind, MI.getLoc()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t ARMMCCodeEmitter::
|
||||
|
@ -15,3 +15,8 @@
|
||||
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movw_lo16
|
||||
@ CHECK: movt r9, :upper16:_foo @ encoding: [A,0x90'A',0b0100AAAA,0xe3]
|
||||
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_arm_movt_hi16
|
||||
|
||||
mov r2, fred
|
||||
|
||||
@ CHECK: movw r2, fred @ encoding: [A,0x20'A',0b0000AAAA,0xe3]
|
||||
@ CHECK: @ fixup A - offset: 0, value: fred, kind: fixup_arm_movw_lo16
|
||||
|
Loading…
x
Reference in New Issue
Block a user