[llvm-commits] [llvm] r144422 - in /llvm/trunk/lib: TableGen/Record.cpp Target/ARM/AsmParser/ARMAsmParser.cpp

Jim Grosbach grosbach at apple.com
Fri Nov 11 15:14:34 PST 2011


Oops. The tblgen change was meant to be a separate commit. It's just changing an llvm_unreachable that's actually reachable into a real diagnostic.

-j
On Nov 11, 2011, at 3:08 PM, Jim Grosbach wrote:

> Author: grosbach
> Date: Fri Nov 11 17:08:10 2011
> New Revision: 144422
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=144422&view=rev
> Log:
> ARM vldm and vstm VFP instructions can take a data type suffix.
> 
> It's ignored by the assembler when present, but is legal syntax. Other
> instructions have something similar, but for some mnemonics it's
> only sometimes not significant, so this quick check in the parser will
> need refactored into something more robust soon-ish. This gets some
> basics working in the meantime.
> 
> Partial for rdar://10435264
> 
> Modified:
>    llvm/trunk/lib/TableGen/Record.cpp
>    llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
> 
> Modified: llvm/trunk/lib/TableGen/Record.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=144422&r1=144421&r2=144422&view=diff
> ==============================================================================
> --- llvm/trunk/lib/TableGen/Record.cpp (original)
> +++ llvm/trunk/lib/TableGen/Record.cpp Fri Nov 11 17:08:10 2011
> @@ -1699,7 +1699,7 @@
>   assert(TypedName && "Record name is not typed!");
>   RecTy *Type = TypedName->getType();
>   if (dynamic_cast<StringRecTy *>(Type) == 0) {
> -    llvm_unreachable("Record name is not a string!");
> +    throw "Record name is not a string!";
>   }
> }
> 
> 
> 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=144422&r1=144421&r2=144422&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Nov 11 17:08:10 2011
> @@ -4179,6 +4179,22 @@
>   return false;
> }
> 
> +static bool isDataTypeToken(StringRef Tok) {
> +  return Tok == ".8" || Tok == ".16" || Tok == ".32" || Tok == ".64" ||
> +    Tok == ".i8" || Tok == ".i16" || Tok == ".i32" || Tok == ".i64" ||
> +    Tok == ".u8" || Tok == ".u16" || Tok == ".u32" || Tok == ".u64" ||
> +    Tok == ".s8" || Tok == ".s16" || Tok == ".s32" || Tok == ".s64" ||
> +    Tok == ".p8" || Tok == ".p16" || Tok == ".f32" || Tok == ".f64" ||
> +    Tok == ".f" || Tok == ".d";
> +}
> +
> +// FIXME: This bit should probably be handled via an explicit match class
> +// in the .td files that matches the suffix instead of having it be
> +// a literal string token the way it is now.
> +static bool doesIgnoreDataTypeSuffix(StringRef Mnemonic, StringRef DT) {
> +  return Mnemonic.startswith("vldm") || Mnemonic.startswith("vstm");
> +}
> +
> /// Parse an arm instruction mnemonic followed by its operands.
> bool ARMAsmParser::ParseInstruction(StringRef Name, SMLoc NameLoc,
>                                SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
> @@ -4283,6 +4299,12 @@
>     Next = Name.find('.', Start + 1);
>     StringRef ExtraToken = Name.slice(Start, Next);
> 
> +    // Some NEON instructions have an optional datatype suffix that is
> +    // completely ignored. Check for that.
> +    if (isDataTypeToken(ExtraToken) &&
> +        doesIgnoreDataTypeSuffix(Mnemonic, ExtraToken))
> +      continue;
> +
>     if (ExtraToken != ".n") {
>       SMLoc Loc = SMLoc::getFromPointer(NameLoc.getPointer() + Start);
>       Operands.push_back(ARMOperand::CreateToken(ExtraToken, Loc));
> 
> 
> _______________________________________________
> 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