summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorSimon Dardis <simon.dardis@imgtec.com>2016-05-27 13:56:36 +0000
committerSimon Dardis <simon.dardis@imgtec.com>2016-05-27 13:56:36 +0000
commit4ccda502d5c63e13e5f6777cfc1570b5d585b841 (patch)
tree2134491f3f707197386978c64856a641ed661802 /llvm/lib/Target
parent2e018efa9be05c7dc30bc816e9db8b49a2791405 (diff)
downloadbcm5719-llvm-4ccda502d5c63e13e5f6777cfc1570b5d585b841.tar.gz
bcm5719-llvm-4ccda502d5c63e13e5f6777cfc1570b5d585b841.zip
[mips] Weaken asm predicate for memory offsets
The isMemWithSimmOffset predicate rejects relocations which is incorrect behaviour. Linkers and other tools should handle|warn|error when the field overflows. Reviewers: dsanders, vkalintiris Differential Revision: http://reviews.llvm.org/D20727 llvm-svn: 270995
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
index b22a7fb0078..523cdd4098a 100644
--- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -1073,11 +1073,15 @@ public:
bool isConstantMemOff() const {
return isMem() && isa<MCConstantExpr>(getMemOff());
}
+ // Allow relocation operators.
+ // FIXME: This predicate and others need to look through binary expressions
+ // and determine whether a Value is a constant or not.
template <unsigned Bits, unsigned ShiftAmount = 0>
bool isMemWithSimmOffset() const {
- return isMem() && isConstantMemOff() &&
- isShiftedInt<Bits, ShiftAmount>(getConstantMemOff()) &&
- getMemBase()->isGPRAsmReg();
+ return isMem() && getMemBase()->isGPRAsmReg() &&
+ (isa<MCTargetExpr>(getMemOff()) ||
+ (isConstantMemOff() &&
+ isShiftedInt<Bits, ShiftAmount>(getConstantMemOff())));
}
bool isMemWithGRPMM16Base() const {
return isMem() && getMemBase()->isMM16AsmReg();
OpenPOWER on IntegriCloud