mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
fix a bug where we had an implicit assumption that the
result instruction operand numbering matched the result pattern. Fixing this allows us to move the xchg/test aliases to the .td file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118334 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -459,3 +459,21 @@ CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T) : TheDef(R) {
|
||||
" instruction expects " + utostr(ResultInst->Operands.size())+
|
||||
" operands!");
|
||||
}
|
||||
|
||||
/// getResultInstOperandIndexForResultOperandIndex - Given an index into the
|
||||
/// ResultOperands array, translate it to a valid index in ResultInst's
|
||||
/// operand list.
|
||||
unsigned CodeGenInstAlias::
|
||||
getResultInstOperandIndexForResultOperandIndex(unsigned OpNo) const {
|
||||
unsigned OpIdx = 0;
|
||||
|
||||
for (unsigned i = 0;; ++i) {
|
||||
assert(i != ResultInst->Operands.size() && "Didn't find entry");
|
||||
if (ResultInst->Operands[i].getTiedRegister() != -1)
|
||||
continue;
|
||||
|
||||
if (OpIdx == OpNo) return i;
|
||||
|
||||
++OpIdx;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user