Skip to content

Commit

Permalink
Hexagon: Remove switch cases from GetDotNewPredOp and isPostIncrement…
Browse files Browse the repository at this point in the history
… functions.

No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181535 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
JyotsnaVerma committed May 9, 2013
1 parent 4b7b3a7 commit 80d81aa
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 593 deletions.
119 changes: 42 additions & 77 deletions lib/Target/Hexagon/HexagonInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,83 +735,6 @@ bool HexagonInstrInfo::isNewValueStore(const MachineInstr *MI) const {
}
}

bool HexagonInstrInfo::isPostIncrement (const MachineInstr* MI) const {
switch (MI->getOpcode())
{
default: return false;
// Load Byte
case Hexagon::POST_LDrib:
case Hexagon::POST_LDrib_cPt:
case Hexagon::POST_LDrib_cNotPt:
case Hexagon::POST_LDrib_cdnPt_V4:
case Hexagon::POST_LDrib_cdnNotPt_V4:

// Load unsigned byte
case Hexagon::POST_LDriub:
case Hexagon::POST_LDriub_cPt:
case Hexagon::POST_LDriub_cNotPt:
case Hexagon::POST_LDriub_cdnPt_V4:
case Hexagon::POST_LDriub_cdnNotPt_V4:

// Load halfword
case Hexagon::POST_LDrih:
case Hexagon::POST_LDrih_cPt:
case Hexagon::POST_LDrih_cNotPt:
case Hexagon::POST_LDrih_cdnPt_V4:
case Hexagon::POST_LDrih_cdnNotPt_V4:

// Load unsigned halfword
case Hexagon::POST_LDriuh:
case Hexagon::POST_LDriuh_cPt:
case Hexagon::POST_LDriuh_cNotPt:
case Hexagon::POST_LDriuh_cdnPt_V4:
case Hexagon::POST_LDriuh_cdnNotPt_V4:

// Load word
case Hexagon::POST_LDriw:
case Hexagon::POST_LDriw_cPt:
case Hexagon::POST_LDriw_cNotPt:
case Hexagon::POST_LDriw_cdnPt_V4:
case Hexagon::POST_LDriw_cdnNotPt_V4:

// Load double word
case Hexagon::POST_LDrid:
case Hexagon::POST_LDrid_cPt:
case Hexagon::POST_LDrid_cNotPt:
case Hexagon::POST_LDrid_cdnPt_V4:
case Hexagon::POST_LDrid_cdnNotPt_V4:

// Store byte
case Hexagon::POST_STbri:
case Hexagon::POST_STbri_cPt:
case Hexagon::POST_STbri_cNotPt:
case Hexagon::POST_STbri_cdnPt_V4:
case Hexagon::POST_STbri_cdnNotPt_V4:

// Store halfword
case Hexagon::POST_SThri:
case Hexagon::POST_SThri_cPt:
case Hexagon::POST_SThri_cNotPt:
case Hexagon::POST_SThri_cdnPt_V4:
case Hexagon::POST_SThri_cdnNotPt_V4:

// Store word
case Hexagon::POST_STwri:
case Hexagon::POST_STwri_cPt:
case Hexagon::POST_STwri_cNotPt:
case Hexagon::POST_STwri_cdnPt_V4:
case Hexagon::POST_STwri_cdnNotPt_V4:

// Store double word
case Hexagon::POST_STdri:
case Hexagon::POST_STdri_cPt:
case Hexagon::POST_STdri_cNotPt:
case Hexagon::POST_STdri_cdnPt_V4:
case Hexagon::POST_STdri_cdnNotPt_V4:
return true;
}
}

bool HexagonInstrInfo::isNewValueInst(const MachineInstr *MI) const {
if (isNewValueJump(MI))
return true;
Expand Down Expand Up @@ -1672,6 +1595,10 @@ bool HexagonInstrInfo::isNewValueJump(const MachineInstr *MI) const {
return false;
}

bool HexagonInstrInfo::isPostIncrement (const MachineInstr* MI) const {
return (getAddrMode(MI) == HexagonII::PostInc);
}

bool HexagonInstrInfo::isNewValue(const MachineInstr* MI) const {
const uint64_t F = MI->getDesc().TSFlags;
return ((F >> HexagonII::NewValuePos) & HexagonII::NewValueMask);
Expand All @@ -1684,6 +1611,44 @@ bool HexagonInstrInfo::isDotNewInst (const MachineInstr* MI) const {
(isPredicated(MI) && isPredicatedNew(MI)));
}

// Return .new predicate version for an instruction.
int HexagonInstrInfo::GetDotNewPredOp(MachineInstr *MI,
const MachineBranchProbabilityInfo
*MBPI) const {

int NewOpcode = Hexagon::getPredNewOpcode(MI->getOpcode());
if (NewOpcode >= 0) // Valid predicate new instruction
return NewOpcode;

switch (MI->getOpcode()) {
default: llvm_unreachable("Unknown .new type");
// Condtional Jumps
case Hexagon::JMP_t:
case Hexagon::JMP_f:
return getDotNewPredJumpOp(MI, MBPI);

case Hexagon::JMPR_t:
return Hexagon::JMPR_tnew_tV3;

case Hexagon::JMPR_f:
return Hexagon::JMPR_fnew_tV3;

case Hexagon::JMPret_t:
return Hexagon::JMPret_tnew_tV3;

case Hexagon::JMPret_f:
return Hexagon::JMPret_fnew_tV3;


// Conditional combine
case Hexagon::COMBINE_rr_cPt :
return Hexagon::COMBINE_rr_cdnPt;
case Hexagon::COMBINE_rr_cNotPt :
return Hexagon::COMBINE_rr_cdnNotPt;
}
}


unsigned HexagonInstrInfo::getAddrMode(const MachineInstr* MI) const {
const uint64_t F = MI->getDesc().TSFlags;

Expand Down
3 changes: 3 additions & 0 deletions lib/Target/Hexagon/HexagonInstrInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ class HexagonInstrInfo : public HexagonGenInstrInfo {
bool isNewValueInst(const MachineInstr* MI) const;
bool isNewValue(const MachineInstr* MI) const;
bool isDotNewInst(const MachineInstr* MI) const;
int GetDotNewPredOp(MachineInstr *MI,
const MachineBranchProbabilityInfo
*MBPI) const;
bool isDeallocRet(const MachineInstr *MI) const;
unsigned getInvertedPredicatedOpcode(const int Opc) const;
bool isExtendable(const MachineInstr* MI) const;
Expand Down
Loading

0 comments on commit 80d81aa

Please sign in to comment.