From b501d4f673c0db267a76800339f9943f2ce6fe33 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 1 Nov 2010 05:34:34 +0000 Subject: Implement enough of the missing instalias support to get aliases installed and working. They now work when the matched pattern and the result instruction have exactly the same operand list. This is now enough for us to define proper aliases for movzx and movsx, implementing rdar://8017633 and PR7459. Note that we do not accept instructions like: movzx 0(%rsp), %rsi GAS accepts this instruction, but it doesn't make any sense because we don't know the size of the memory operand. It could be 8/16/32 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117901 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/CodeGenInstruction.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'utils/TableGen/CodeGenInstruction.cpp') diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp index 8a05374d8c..7428f2c88f 100644 --- a/utils/TableGen/CodeGenInstruction.cpp +++ b/utils/TableGen/CodeGenInstruction.cpp @@ -110,6 +110,12 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) { MIOperandNo, NumOps, MIOpInfo)); MIOperandNo += NumOps; } + + + // Make sure the constraints list for each operand is large enough to hold + // constraint info, even if none is present. + for (unsigned i = 0, e = OperandList.size(); i != e; ++i) + OperandList[i].Constraints.resize(OperandList[i].MINumOperands); } @@ -235,11 +241,6 @@ static void ParseConstraint(const std::string &CStr, CGIOperandList &Ops) { } static void ParseConstraints(const std::string &CStr, CGIOperandList &Ops) { - // Make sure the constraints list for each operand is large enough to hold - // constraint info, even if none is present. - for (unsigned i = 0, e = Ops.size(); i != e; ++i) - Ops[i].Constraints.resize(Ops[i].MINumOperands); - if (CStr.empty()) return; const std::string delims(","); @@ -390,5 +391,5 @@ FlattenAsmStringVariants(StringRef Cur, unsigned Variant) { CodeGenInstAlias::CodeGenInstAlias(Record *R) : TheDef(R), Operands(R) { AsmString = R->getValueAsString("AsmString"); - + Result = R->getValueAsDag("ResultInst"); } -- cgit v1.2.3-70-g09d2