[LLVMdev] AsmParser for backend

Jonathan gamma_chen at yahoo.com.tw
Tue Feb 5 06:59:59 PST 2013


Ulrich,

Very thank your help, it's OK now. I add the ParserMethod and ParserMatchClass and it work.

Jonathan

On 2013/2/5, at 下午10:20, Ulrich Weigand <Ulrich.Weigand at de.ibm.com> wrote:

> Jonathan <gamma_chen at yahoo.com.tw> wrote:
> 
>> I try to create a backend to support AsmParser, but it hasn't the red
> part
>> as below. I find the Mips has this. Do you know how to make it appear?
>> 
>> Jonathan
>> 
>> #ifdef GET_ASSEMBLER_HEADER
>> #undef GET_ASSEMBLER_HEADER
>>  // This should be included into the middle of the declaration of
>>  // your subclasses implementation of MCTargetAsmParser.
>>  unsigned ComputeAvailableFeatures(uint64_t FeatureBits) const;
>>  void convertToMCInst(unsigned Kind, MCInst &Inst, unsigned Opcode,
>>                       const SmallVectorImpl<MCParsedAsmOperand*>
> &Operands);
>>  void convertToMapAndConstraints(unsigned Kind,
>>                           const
>> SmallVectorImpl<MCParsedAsmOperand*> &Operands);
>>  bool mnemonicIsValid(StringRef Mnemonic);
>>  unsigned MatchInstructionImpl(
>>                           const
>> SmallVectorImpl<MCParsedAsmOperand*> &Operands,
>>                                MCInst &Inst,
>>                                unsigned &ErrorInfo, bool
> matchingInlineAsm,
>>                                unsigned VariantID = 0);
>> 
>>  enum OperandMatchResultTy {
>>    MatchOperand_Success,    // operand matched successfully
>>    MatchOperand_NoMatch,    // operand did not match
>>    MatchOperand_ParseFail   // operand matched but had errors
>>  };
>>  OperandMatchResultTy MatchOperandParserImpl(
>>    SmallVectorImpl<MCParsedAsmOperand*> &Operands,
>>    StringRef Mnemonic);
>>  OperandMatchResultTy tryCustomParseOperand(
>>    SmallVectorImpl<MCParsedAsmOperand*> &Operands,
>>    unsigned MCK);
>> 
>> #endif // GET_ASSEMBLER_HEADER_INFO
> 
> My understanding is that this will be generated automatically
> if any instruction has an operand that needs a custom parser
> (i.e. one that has been defined using the ParserMethod attribute).
> 
> Bye,
> Ulrich
> 





More information about the llvm-dev mailing list