summaryrefslogtreecommitdiff
path: root/lib/Target/TargetInstrInfo.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-05-05 00:30:09 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-05-05 00:30:09 +0000
commitd923fc621ff5b5e500977edf9236c9e34e8d7ebc (patch)
treef19d8c37456b68e0e2be75508d57fc3e9cce01c9 /lib/Target/TargetInstrInfo.cpp
parentc3806ea3bc3718d1f72de60e791c771c602189dc (diff)
downloadllvm-d923fc621ff5b5e500977edf9236c9e34e8d7ebc.tar.gz
llvm-d923fc621ff5b5e500977edf9236c9e34e8d7ebc.tar.bz2
llvm-d923fc621ff5b5e500977edf9236c9e34e8d7ebc.tar.xz
Move getInstrOperandRegClass from the scheduler to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetInstrInfo.cpp')
-rw-r--r--lib/Target/TargetInstrInfo.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Target/TargetInstrInfo.cpp b/lib/Target/TargetInstrInfo.cpp
index 1bdeef4009..ceaea0c202 100644
--- a/lib/Target/TargetInstrInfo.cpp
+++ b/lib/Target/TargetInstrInfo.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Constant.h"
#include "llvm/DerivedTypes.h"
using namespace llvm;
@@ -35,3 +36,15 @@ bool TargetInstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
return true;
return !isPredicated(MI);
}
+
+/// getInstrOperandRegClass - Return register class of the operand of an
+/// instruction of the specified TargetInstrDesc.
+const TargetRegisterClass*
+llvm::getInstrOperandRegClass(const TargetRegisterInfo *TRI,
+ const TargetInstrDesc &II, unsigned Op) {
+ if (Op >= II.getNumOperands())
+ return NULL;
+ if (II.OpInfo[Op].isLookupPtrRegClass())
+ return TRI->getPointerRegClass();
+ return TRI->getRegClass(II.OpInfo[Op].RegClass);
+}