diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-11-01 23:00:31 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-11-01 23:00:31 +0000 |
commit | 1b2e60e9705d5ea1a58ca46223f0221643f9e9ae (patch) | |
tree | a6e47c28e7168b94bf34e4a830cdc0e2c188110d /llvm/lib | |
parent | 1359196c4e617db3cbf19507ed2ac8a2160ca15e (diff) | |
download | bcm5719-llvm-1b2e60e9705d5ea1a58ca46223f0221643f9e9ae.tar.gz bcm5719-llvm-1b2e60e9705d5ea1a58ca46223f0221643f9e9ae.zip |
Added getTiedToSrcOperand() to check for two-address'ness.
llvm-svn: 31360
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/TargetInstrInfo.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetInstrInfo.cpp b/llvm/lib/Target/TargetInstrInfo.cpp index 4346203d917..81759098ed8 100644 --- a/llvm/lib/Target/TargetInstrInfo.cpp +++ b/llvm/lib/Target/TargetInstrInfo.cpp @@ -38,6 +38,18 @@ TargetInstrInfo::~TargetInstrInfo() { TargetInstrDescriptors = NULL; // reset global variable } +int +TargetInstrInfo::getTiedToSrcOperand(MachineOpCode Opc, unsigned OpNum) const { + for (unsigned i = 0, e = getNumOperands(Opc); i != e; ++i) { + if (i == OpNum) + continue; + int ti = getOperandConstraint(Opc, i, TIED_TO); + if (ti == (int)OpNum) + return i; + } + return -1; +} + // commuteInstruction - The default implementation of this method just exchanges // operand 1 and 2. |