[llvm-commits] [llvm] r162954 - /llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Chad Rosier mcrosier at apple.com
Fri Aug 31 10:26:21 PDT 2012


On Aug 30, 2012, at 5:45 PM, Jim Grosbach wrote:

> Hi Chad,
> 
> Thanks for moving this to it's more proper home. I think we can take this a bit further, though, as in validateInstruction() we already have a real MCInst, so we don't need to query the Operands array. We can just check the MCOperand values. For example, see how the SBFX check above this one grabs the immediate operands.

Committed revision 163005.  This should clarify what's going on.  Thanks, Jim.

> 
> -Jim
> 
> On Aug 30, 2012, at 4:20 PM, Chad Rosier <mcrosier at apple.com> wrote:
> 
>> Author: mcrosier
>> Date: Thu Aug 30 18:20:38 2012
>> New Revision: 162954
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=162954&view=rev
>> Log:
>> Move a check to the validateInstruction() function where it more properly belongs.
>> 
>> Modified:
>>   llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
>> 
>> Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=162954&r1=162953&r2=162954&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
>> +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Aug 30 18:20:38 2012
>> @@ -4150,17 +4150,6 @@
>> bool ARMAsmParser::
>> cvtThumbMultiply(MCInst &Inst, unsigned Opcode,
>>           const SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
>> -  // The second source operand must be the same register as the destination
>> -  // operand.
>> -  if (Operands.size() == 6 &&
>> -      (((ARMOperand*)Operands[3])->getReg() !=
>> -       ((ARMOperand*)Operands[5])->getReg()) &&
>> -      (((ARMOperand*)Operands[3])->getReg() !=
>> -       ((ARMOperand*)Operands[4])->getReg())) {
>> -    Error(Operands[3]->getStartLoc(),
>> -          "destination register must match source register");
>> -    return false;
>> -  }
>>  ((ARMOperand*)Operands[3])->addRegOperands(Inst, 1);
>>  ((ARMOperand*)Operands[1])->addCCOutOperands(Inst, 1);
>>  // If we have a three-operand form, make sure to set Rn to be the operand
>> @@ -5377,6 +5366,19 @@
>>                   "in register list");
>>    break;
>>  }
>> +  case ARM::tMUL: {
>> +    // The second source operand must be the same register as the destination
>> +    // operand.
>> +    if (Operands.size() == 6 &&
>> +        (((ARMOperand*)Operands[3])->getReg() !=
>> +         ((ARMOperand*)Operands[5])->getReg()) &&
>> +        (((ARMOperand*)Operands[3])->getReg() !=
>> +         ((ARMOperand*)Operands[4])->getReg())) {
>> +      Error(Operands[3]->getStartLoc(),
>> +            "destination register must match source register");
>> +    }
>> +    break;
>> +  }
>>  // Like for ldm/stm, push and pop have hi-reg handling version in Thumb2,
>>  // so only issue a diagnostic for thumb1. The instructions will be
>>  // switched to the t2 encodings in processInstruction() if necessary.
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 




More information about the llvm-commits mailing list