blob: 1bdeef400970bdeb8f3c828d19fa77e5811df44e [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- TargetInstrInfo.cpp - Target Instruction Information --------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the TargetInstrInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/Target/TargetInstrInfo.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000015#include "llvm/Constant.h"
16#include "llvm/DerivedTypes.h"
17using namespace llvm;
18
Chris Lattner5b930372008-01-07 07:27:27 +000019TargetInstrInfo::TargetInstrInfo(const TargetInstrDesc* Desc,
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020 unsigned numOpcodes)
Chris Lattner5b930372008-01-07 07:27:27 +000021 : Descriptors(Desc), NumOpcodes(numOpcodes) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000022}
23
24TargetInstrInfo::~TargetInstrInfo() {
25}
26
Dan Gohmanf17a25c2007-07-18 16:29:46 +000027bool TargetInstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
Chris Lattner5b930372008-01-07 07:27:27 +000028 const TargetInstrDesc &TID = MI->getDesc();
29 if (!TID.isTerminator()) return false;
Chris Lattner62327602008-01-07 01:56:04 +000030
31 // Conditional branch is a special case.
Chris Lattner5b930372008-01-07 07:27:27 +000032 if (TID.isBranch() && !TID.isBarrier())
Chris Lattner62327602008-01-07 01:56:04 +000033 return true;
Chris Lattner5b930372008-01-07 07:27:27 +000034 if (!TID.isPredicable())
Chris Lattner62327602008-01-07 01:56:04 +000035 return true;
36 return !isPredicated(MI);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000037}