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/Target/TargetRegisterInfo.h"
16 #include "llvm/Support/ErrorHandling.h"
19 TargetInstrInfo::TargetInstrInfo(const TargetInstrDesc* Desc,
21 : Descriptors(Desc), NumOpcodes(numOpcodes) {
24 TargetInstrInfo::~TargetInstrInfo() {
27 /// insertNoop - Insert a noop into the instruction stream at the specified
29 void TargetInstrInfo::insertNoop(MachineBasicBlock &MBB,
30 MachineBasicBlock::iterator MI) const {
31 llvm_unreachable("Target didn't implement insertNoop!");
35 bool TargetInstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
36 const TargetInstrDesc &TID = MI->getDesc();
37 if (!TID.isTerminator()) return false;
39 // Conditional branch is a special case.
40 if (TID.isBranch() && !TID.isBarrier())
42 if (!TID.isPredicable())
44 return !isPredicated(MI);
47 /// getRegClass - Get the register class for the operand, handling resolution
48 /// of "symbolic" pointer register classes etc. If this is not a register
49 /// operand, this returns null.
50 const TargetRegisterClass *
51 TargetOperandInfo::getRegClass(const TargetRegisterInfo *TRI) const {
52 if (isLookupPtrRegClass())
53 return TRI->getPointerRegClass(RegClass);
54 return TRI->getRegClass(RegClass);