diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2015-04-22 17:51:26 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2015-04-22 17:51:26 +0000 |
commit | 05902163b66e7633f84ee8e591b191c13209b348 (patch) | |
tree | b1789ac42707ff4e3adc8013231975b4174b760b | |
parent | a63b04dfa1741dbeb20514855dd32064da59e058 (diff) | |
download | bcm5719-llvm-05902163b66e7633f84ee8e591b191c13209b348.tar.gz bcm5719-llvm-05902163b66e7633f84ee8e591b191c13209b348.zip |
[Hexagon] Consider constant-extended offsets to be valid
llvm-svn: 235529
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp | 23 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonInstrInfo.h | 2 |
2 files changed, 15 insertions, 10 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp index 08330a35855..9658a5a84df 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -1171,10 +1171,10 @@ bool HexagonInstrInfo::isDeallocRet(const MachineInstr *MI) const { } -bool HexagonInstrInfo:: -isValidOffset(const int Opcode, const int Offset) const { +bool HexagonInstrInfo::isValidOffset(unsigned Opcode, int Offset, + bool Extend) const { // This function is to check whether the "Offset" is in the correct range of - // the given "Opcode". If "Offset" is not in the correct range, "ADD_ri" is + // the given "Opcode". If "Offset" is not in the correct range, "A2_addi" is // inserted to calculate the final address. Due to this reason, the function // assumes that the "Offset" has correct alignment. // We used to assert if the offset was not properly aligned, however, @@ -1182,8 +1182,16 @@ isValidOffset(const int Opcode, const int Offset) const { // problem, and we need to allow for it. The front end warns of such // misaligns with respect to load size. - switch(Opcode) { + switch (Opcode) { + case Hexagon::J2_loop0i: + case Hexagon::J2_loop1i: + return isUInt<10>(Offset); + } + + if (Extend) + return true; + switch (Opcode) { case Hexagon::L2_loadri_io: case Hexagon::S2_storeri_io: return (Offset >= Hexagon_MEMW_OFFSET_MIN) && @@ -1207,7 +1215,6 @@ isValidOffset(const int Opcode, const int Offset) const { (Offset <= Hexagon_MEMB_OFFSET_MAX); case Hexagon::A2_addi: - case Hexagon::TFR_FI: return (Offset >= Hexagon_ADDI_OFFSET_MIN) && (Offset <= Hexagon_ADDI_OFFSET_MAX); @@ -1241,10 +1248,8 @@ isValidOffset(const int Opcode, const int Offset) const { case Hexagon::LDriw_pred: return true; - case Hexagon::J2_loop0i: - return isUInt<10>(Offset); - - // INLINEASM is very special. + case Hexagon::TFR_FI: + case Hexagon::TFR_FIA: case Hexagon::INLINEASM: return true; } diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.h b/llvm/lib/Target/Hexagon/HexagonInstrInfo.h index 284dde1f91e..ac88ea6e0a4 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.h +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.h @@ -160,7 +160,7 @@ public: bool isSchedulingBoundary(const MachineInstr *MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override; - bool isValidOffset(const int Opcode, const int Offset) const; + bool isValidOffset(unsigned Opcode, int Offset, bool Extend = true) const; bool isValidAutoIncImm(const EVT VT, const int Offset) const; bool isMemOp(const MachineInstr *MI) const; bool isSpillPredRegOp(const MachineInstr *MI) const; |