aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-04-09 17:06:24 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-04-09 17:06:24 +0000
commit37831d0a1202ab105b495762cb6cce7b6eb2438c (patch)
treefd46cdcc9a8aad9dacd6c2c37f3824ca5683e58b
parent0c8382ce9a96e36325b17d242fd1af16564d8a85 (diff)
The way we are trying to figure out banksel immediate operand may yield different results for different type of insns. This will eventually need to be changed but currently let us prevent the crash in cases of incorrect detection of banksel operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68713 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PIC16/PIC16AsmPrinter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp
index 2af42cd16d..5c4b353294 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp
@@ -77,8 +77,9 @@ bool PIC16AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
// This is not true for external variables as section names for global
// variables in all files are same at this time. For eg. initialized
// data in put in idata.# section in all files.
- if (((int)BS.getImm() == 1) &&
- ((Op.isGlobal() && Op.getGlobal()->hasExternalLinkage()) ||
+ if ((BS.getType() == MachineOperand::MO_Immediate
+ && (int)BS.getImm() == 1)
+ && ((Op.isGlobal() && Op.getGlobal()->hasExternalLinkage()) ||
(NewBank.compare(CurBank) != 0))) {
O << "\tbanksel ";
printOperand(MI, BankSelVar);