LLVM API Documentation
00001 //===-- TargetInstrInfo.cpp - Target Instruction Information --------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements the TargetInstrInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #include "llvm/Target/TargetInstrInfo.h" 00015 #include "llvm/Constant.h" 00016 #include "llvm/DerivedTypes.h" 00017 using namespace llvm; 00018 00019 /// findTiedToSrcOperand - Returns the operand that is tied to the specified 00020 /// dest operand. Returns -1 if there isn't one. 00021 int TargetInstrDesc::findTiedToSrcOperand(unsigned OpNum) const { 00022 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { 00023 if (i == OpNum) 00024 continue; 00025 if (getOperandConstraint(i, TOI::TIED_TO) == (int)OpNum) 00026 return i; 00027 } 00028 return -1; 00029 } 00030 00031 00032 TargetInstrInfo::TargetInstrInfo(const TargetInstrDesc* Desc, 00033 unsigned numOpcodes) 00034 : Descriptors(Desc), NumOpcodes(numOpcodes) { 00035 } 00036 00037 TargetInstrInfo::~TargetInstrInfo() { 00038 } 00039 00040 bool TargetInstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const { 00041 const TargetInstrDesc &TID = MI->getDesc(); 00042 if (!TID.isTerminator()) return false; 00043 00044 // Conditional branch is a special case. 00045 if (TID.isBranch() && !TID.isBarrier()) 00046 return true; 00047 if (!TID.isPredicable()) 00048 return true; 00049 return !isPredicated(MI); 00050 }
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.