clarify: stub emission depends on the version of the linker you use, it has nothing
[oota-llvm.git] / lib / Target / TargetInstrInfo.cpp
1 //===-- TargetInstrInfo.cpp - Target Instruction Information --------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the TargetInstrInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/Target/TargetInstrInfo.h"
15 #include "llvm/Target/TargetRegisterInfo.h"
16 #include "llvm/Constant.h"
17 #include "llvm/DerivedTypes.h"
18 using namespace llvm;
19
20 TargetInstrInfo::TargetInstrInfo(const TargetInstrDesc* Desc,
21                                  unsigned numOpcodes)
22   : Descriptors(Desc), NumOpcodes(numOpcodes) {
23 }
24
25 TargetInstrInfo::~TargetInstrInfo() {
26 }
27
28 bool TargetInstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
29   const TargetInstrDesc &TID = MI->getDesc();
30   if (!TID.isTerminator()) return false;
31   
32   // Conditional branch is a special case.
33   if (TID.isBranch() && !TID.isBarrier())
34     return true;
35   if (!TID.isPredicable())
36     return true;
37   return !isPredicated(MI);
38 }
39
40 /// getInstrOperandRegClass - Return register class of the operand of an
41 /// instruction of the specified TargetInstrDesc.
42 const TargetRegisterClass*
43 llvm::getInstrOperandRegClass(const TargetRegisterInfo *TRI,
44                         const TargetInstrDesc &II, unsigned Op) {
45   if (Op >= II.getNumOperands())
46     return NULL;
47   if (II.OpInfo[Op].isLookupPtrRegClass())
48     return TRI->getPointerRegClass();
49   return TRI->getRegClass(II.OpInfo[Op].RegClass);
50 }