diff options
| author | Akira Hatanaka <ahatanaka@mips.com> | 2012-11-17 00:25:41 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-11-17 00:25:41 +0000 |
| commit | ef83919b4c2a000d6e28fb4a4c5ade073a3838cc (patch) | |
| tree | cd0c2dde1fac3ba27d5b11ace9c16b1a8044eb2d /llvm/lib/Target/Mips | |
| parent | 9578222e0ddd1630fd114185070e7a3001ca3b31 (diff) | |
| download | bcm5719-llvm-ef83919b4c2a000d6e28fb4a4c5ade073a3838cc.tar.gz bcm5719-llvm-ef83919b4c2a000d6e28fb4a4c5ade073a3838cc.zip | |
Initial implementation of MipsTargetLowering::isLegalAddressingMode.
llvm-svn: 168230
Diffstat (limited to 'llvm/lib/Target/Mips')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsISelLowering.cpp | 20 | ||||
| -rw-r--r-- | llvm/lib/Target/Mips/MipsISelLowering.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index e225b6c28eb..6202ae9a30c 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -3483,6 +3483,26 @@ void MipsTargetLowering::LowerAsmOperandForConstraint(SDValue Op, } bool +MipsTargetLowering::isLegalAddressingMode(const AddrMode &AM, Type *Ty) const { + // No global is ever allowed as a base. + if (AM.BaseGV) + return false; + + switch (AM.Scale) { + case 0: // "r+i" or just "i", depending on HasBaseReg. + break; + case 1: + if (!AM.HasBaseReg) // allow "r+i". + break; + return false; // disallow "r+r" or "r+r+i". + default: + return false; + } + + return true; +} + +bool MipsTargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const { // The Mips target isn't yet aware of offsets. return false; diff --git a/llvm/lib/Target/Mips/MipsISelLowering.h b/llvm/lib/Target/Mips/MipsISelLowering.h index 43f97e89a7b..2c17def06a1 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.h +++ b/llvm/lib/Target/Mips/MipsISelLowering.h @@ -357,6 +357,8 @@ namespace llvm { std::vector<SDValue> &Ops, SelectionDAG &DAG) const; + virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const; + virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; virtual EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, |

