diff options
author | Jim Grosbach <grosbach@apple.com> | 2008-10-07 19:05:35 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2008-10-07 19:05:35 +0000 |
commit | 320c148375723e6e2f850f5e9909da26391a0119 (patch) | |
tree | dc085b630a36b2e187f09d210fccc229e832ee37 /lib | |
parent | d8fd3564c135f40835dce121d6df485a135e9e6b (diff) | |
download | external_llvm-320c148375723e6e2f850f5e9909da26391a0119.zip external_llvm-320c148375723e6e2f850f5e9909da26391a0119.tar.gz external_llvm-320c148375723e6e2f850f5e9909da26391a0119.tar.bz2 |
Encode the conditional execution predicate when JITing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMCodeEmitter.cpp | 20 | ||||
-rw-r--r-- | lib/Target/ARM/ARMInstrInfo.h | 6 |
2 files changed, 16 insertions, 10 deletions
diff --git a/lib/Target/ARM/ARMCodeEmitter.cpp b/lib/Target/ARM/ARMCodeEmitter.cpp index 13f7903..574c14e 100644 --- a/lib/Target/ARM/ARMCodeEmitter.cpp +++ b/lib/Target/ARM/ARMCodeEmitter.cpp @@ -256,8 +256,8 @@ void ARMCodeEmitter::emitInstruction(const MachineInstr &MI) { unsigned ARMCodeEmitter::getAddrModeNoneInstrBinary(const MachineInstr &MI, const TargetInstrDesc &TID, unsigned Binary) { - // FIXME: Assume CC is AL for now. - Binary |= ARMCC::AL << 28; + // Set the conditional execution predicate + Binary |= II->getPredicate(&MI) << 28; switch (TID.TSFlags & ARMII::FormMask) { default: @@ -376,8 +376,8 @@ void ARMCodeEmitter::emitPseudoInstruction(const MachineInstr &MI) { unsigned ARMCodeEmitter::getAddrMode1InstrBinary(const MachineInstr &MI, const TargetInstrDesc &TID, unsigned Binary) { - // FIXME: Assume CC is AL for now. - Binary |= ARMCC::AL << 28; + // Set the conditional execution predicate + Binary |= II->getPredicate(&MI) << 28; // Encode S bit if MI modifies CPSR. Binary |= getAddrMode1SBit(MI, TID); @@ -429,8 +429,8 @@ unsigned ARMCodeEmitter::getAddrMode1InstrBinary(const MachineInstr &MI, unsigned ARMCodeEmitter::getAddrMode2InstrBinary(const MachineInstr &MI, const TargetInstrDesc &TID, unsigned Binary) { - // FIXME: Assume CC is AL for now. - Binary |= ARMCC::AL << 28; + // Set the conditional execution predicate + Binary |= II->getPredicate(&MI) << 28; // Set first operand Binary |= getMachineOpValue(MI, 0) << ARMII::RegRdShift; @@ -470,8 +470,8 @@ unsigned ARMCodeEmitter::getAddrMode2InstrBinary(const MachineInstr &MI, unsigned ARMCodeEmitter::getAddrMode3InstrBinary(const MachineInstr &MI, const TargetInstrDesc &TID, unsigned Binary) { - // FIXME: Assume CC is AL for now. - Binary |= ARMCC::AL << 28; + // Set the conditional execution predicate + Binary |= II->getPredicate(&MI) << 28; // Set first operand Binary |= getMachineOpValue(MI, 0) << ARMII::RegRdShift; @@ -507,8 +507,8 @@ unsigned ARMCodeEmitter::getAddrMode3InstrBinary(const MachineInstr &MI, unsigned ARMCodeEmitter::getAddrMode4InstrBinary(const MachineInstr &MI, const TargetInstrDesc &TID, unsigned Binary) { - // FIXME: Assume CC is AL for now. - Binary |= ARMCC::AL << 28; + // Set the conditional execution predicate + Binary |= II->getPredicate(&MI) << 28; // Set first operand Binary |= getMachineOpValue(MI, 0) << ARMII::RegRnShift; diff --git a/lib/Target/ARM/ARMInstrInfo.h b/lib/Target/ARM/ARMInstrInfo.h index 0b27bfb..da22521 100644 --- a/lib/Target/ARM/ARMInstrInfo.h +++ b/lib/Target/ARM/ARMInstrInfo.h @@ -217,6 +217,12 @@ public: // Predication support. virtual bool isPredicated(const MachineInstr *MI) const; + ARMCC::CondCodes getPredicate(const MachineInstr *MI) const { + int PIdx = MI->findFirstPredOperandIdx(); + return PIdx != -1 ? (ARMCC::CondCodes)MI->getOperand(PIdx).getImm() + : ARMCC::AL; + } + virtual bool PredicateInstruction(MachineInstr *MI, const SmallVectorImpl<MachineOperand> &Pred) const; |