[PATCH] D18571: [lanai] isBrImm should accept any non-constant immediate.
Jacques Pienaar via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 31 11:04:17 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL265032: [lanai] isBrImm should accept any non-constant immediate. (authored by jpienaar).
Changed prior to commit:
http://reviews.llvm.org/D18571?vs=52239&id=52243#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18571
Files:
llvm/trunk/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
llvm/trunk/test/MC/Lanai/ctrl-instructions.s
Index: llvm/trunk/test/MC/Lanai/ctrl-instructions.s
===================================================================
--- llvm/trunk/test/MC/Lanai/ctrl-instructions.s
+++ llvm/trunk/test/MC/Lanai/ctrl-instructions.s
@@ -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
+
Index: llvm/trunk/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
+++ llvm/trunk/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp
@@ -195,23 +195,12 @@
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(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18571.52243.patch
Type: text/x-patch
Size: 2054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160331/0654604c/attachment.bin>
More information about the llvm-commits
mailing list