mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 04:39:44 +00:00
[lanai] isBrImm should accept any non-constant immediate.
isBrImm should accept any non-constant immediate. Previously it was only accepting LanaiMCExpr ones which was wrong. Differential Revision: http://reviews.llvm.org/D18571 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265032 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
54993bc649
commit
1372b02d63
@ -195,23 +195,12 @@ public:
|
||||
return false;
|
||||
|
||||
// Constant case
|
||||
if (const MCConstantExpr *ConstExpr = dyn_cast<MCConstantExpr>(Imm.Value)) {
|
||||
int64_t Value = ConstExpr->getValue();
|
||||
// Check if value fits in 25 bits with 2 least significant bits 0.
|
||||
return isShiftedUInt<23, 2>(static_cast<int32_t>(Value));
|
||||
}
|
||||
|
||||
// Symbolic reference expression
|
||||
if (const LanaiMCExpr *SymbolRefExpr = dyn_cast<LanaiMCExpr>(Imm.Value))
|
||||
return SymbolRefExpr->getKind() == LanaiMCExpr::VK_Lanai_None;
|
||||
|
||||
// Binary expression
|
||||
if (const MCBinaryExpr *BinaryExpr = dyn_cast<MCBinaryExpr>(Imm.Value))
|
||||
if (const LanaiMCExpr *SymbolRefExpr =
|
||||
dyn_cast<LanaiMCExpr>(BinaryExpr->getLHS()))
|
||||
return SymbolRefExpr->getKind() == LanaiMCExpr::VK_Lanai_None;
|
||||
|
||||
return false;
|
||||
const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(Imm.Value);
|
||||
if (!MCE)
|
||||
return true;
|
||||
int64_t Value = MCE->getValue();
|
||||
// Check if value fits in 25 bits with 2 least significant bits 0.
|
||||
return isShiftedUInt<23, 2>(static_cast<int32_t>(Value));
|
||||
}
|
||||
|
||||
bool isBrTarget() { return isBrImm() || isToken(); }
|
||||
|
13
test/MC/Lanai/ctrl-instructions.s
Normal file
13
test/MC/Lanai/ctrl-instructions.s
Normal file
@ -0,0 +1,13 @@
|
||||
// RUN: llvm-mc -triple lanai-unknown-unknown -show-encoding -o - %s | FileCheck %s
|
||||
|
||||
// CHECK: bt .Ltmp0 ! encoding: [0b1110000A,A,A,A]
|
||||
// CHECK-NEXT: ! fixup A - offset: 0, value: .Ltmp0, kind: FIXUP_LANAI_25
|
||||
bt 1f
|
||||
nop
|
||||
1:
|
||||
|
||||
// CHECK: bt foo ! encoding: [0b1110000A,A,A,A]
|
||||
// CHECK-NEXT: ! fixup A - offset: 0, value: foo, kind: FIXUP_LANAI_25
|
||||
bt foo
|
||||
nop
|
||||
|
Loading…
Reference in New Issue
Block a user