1 //===-- TargetInstrInfo.cpp - Target Instruction Information --------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Target/TargetInstrInfo.h"
15 #include "llvm/Constant.h"
16 #include "llvm/DerivedTypes.h"
19 /// findTiedToSrcOperand - Returns the operand that is tied to the specified
20 /// dest operand. Returns -1 if there isn't one.
21 int TargetInstrDescriptor::findTiedToSrcOperand(unsigned OpNum) const {
22 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
25 if (getOperandConstraint(i, TOI::TIED_TO) == (int)OpNum)
32 TargetInstrInfo::TargetInstrInfo(const TargetInstrDescriptor* Desc,
34 : desc(Desc), NumOpcodes(numOpcodes) {
37 TargetInstrInfo::~TargetInstrInfo() {
40 bool TargetInstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
41 const TargetInstrDescriptor *TID = MI->getDesc();
42 if (!TID->isTerminator()) return false;
44 // Conditional branch is a special case.
45 if (TID->isBranch() && !TID->isBarrier())
47 if (!TID->isPredicable())
49 return !isPredicated(MI);