diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-08 17:22:19 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-08 17:22:19 +0000 |
commit | fa2dffbc1a698fac500ec27d0589a26a54d8c2df (patch) | |
tree | 81f240dd3039276aec8467a6004de3f1a2f8305e /llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp | |
parent | 2f7ec9134dfb7aff961d633b6a73e3fb1f4da655 (diff) | |
download | bcm5719-llvm-fa2dffbc1a698fac500ec27d0589a26a54d8c2df.tar.gz bcm5719-llvm-fa2dffbc1a698fac500ec27d0589a26a54d8c2df.zip |
[SystemZ] Support conditional sibling calls via BRCL
This adds a conditional variant of CallJG instruction, CallBRCL.
It can be used for conditional sibling calls. Unfortunately, due
to IfCvt limitations, it only really works well for functions without
arguments.
Author: koriakin
Differential Revision: http://reviews.llvm.org/D18864
llvm-svn: 265814
Diffstat (limited to 'llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp index 80393a6b2f4..8bb548eb980 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -510,7 +510,8 @@ bool SystemZInstrInfo::isPredicable(MachineInstr &MI) const { unsigned Opcode = MI.getOpcode(); if (STI.hasLoadStoreOnCond() && getConditionalMove(Opcode)) return true; - if (Opcode == SystemZ::Return) + if (Opcode == SystemZ::Return || + Opcode == SystemZ::CallJG) return true; return false; } @@ -571,6 +572,19 @@ bool SystemZInstrInfo::PredicateInstruction( .addReg(SystemZ::CC, RegState::Implicit); return true; } + if (Opcode == SystemZ::CallJG) { + const GlobalValue *Global = MI.getOperand(0).getGlobal(); + const uint32_t *RegMask = MI.getOperand(1).getRegMask(); + MI.RemoveOperand(1); + MI.RemoveOperand(0); + MI.setDesc(get(SystemZ::CallBRCL)); + MachineInstrBuilder(*MI.getParent()->getParent(), MI) + .addImm(CCValid).addImm(CCMask) + .addGlobalAddress(Global) + .addRegMask(RegMask) + .addReg(SystemZ::CC, RegState::Implicit); + return true; + } return false; } |