diff options
Diffstat (limited to 'llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp index 6296e4a4800..dcce5a7b7f7 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -132,6 +132,10 @@ bool SystemZInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, if (!Branch.Target->isMBB()) return true; + // Punt on compound branches. + if (Branch.Type != SystemZII::BranchNormal) + return true; + if (Branch.CCMask == SystemZ::CCMASK_ANY) { // Handle unconditional branches. if (!AllowModify) { @@ -361,11 +365,21 @@ SystemZInstrInfo::getBranchInfo(const MachineInstr *MI) const { case SystemZ::BR: case SystemZ::J: case SystemZ::JG: - return SystemZII::Branch(SystemZ::CCMASK_ANY, &MI->getOperand(0)); + return SystemZII::Branch(SystemZII::BranchNormal, SystemZ::CCMASK_ANY, + &MI->getOperand(0)); case SystemZ::BRC: case SystemZ::BRCL: - return SystemZII::Branch(MI->getOperand(0).getImm(), &MI->getOperand(1)); + return SystemZII::Branch(SystemZII::BranchNormal, + MI->getOperand(0).getImm(), &MI->getOperand(1)); + + case SystemZ::CRJ: + return SystemZII::Branch(SystemZII::BranchC, MI->getOperand(2).getImm(), + &MI->getOperand(3)); + + case SystemZ::CGRJ: + return SystemZII::Branch(SystemZII::BranchCG, MI->getOperand(2).getImm(), + &MI->getOperand(3)); default: llvm_unreachable("Unrecognized branch opcode"); @@ -426,6 +440,17 @@ unsigned SystemZInstrInfo::getOpcodeForOffset(unsigned Opcode, return 0; } +unsigned SystemZInstrInfo::getCompareAndBranch(unsigned Opcode) const { + switch (Opcode) { + case SystemZ::CR: + return SystemZ::CRJ; + case SystemZ::CGR: + return SystemZ::CGRJ; + default: + return 0; + } +} + void SystemZInstrInfo::loadImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, unsigned Reg, uint64_t Value) const { |

