[PATCH] [arm] Parse tag names for eabi_attribute directive.

Logan Chien tzuhsiang.chien at gmail.com
Sun Dec 22 05:02:06 PST 2013


Ping


On Thu, Dec 19, 2013 at 2:53 AM, Logan Chien <tzuhsiang.chien at gmail.com>wrote:

>   Address the comments.
>
> Hi richard.barton.arm, rengolin,
>
> http://llvm-reviews.chandlerc.com/D2424
>
> CHANGE SINCE LAST DIFF
>   http://llvm-reviews.chandlerc.com/D2424?vs=6142&id=6169#toc
>
> Files:
>   lib/Target/ARM/AsmParser/ARMAsmParser.cpp
>   test/MC/ARM/directive-eabi_attribute-str.s
>
> Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
> ===================================================================
> --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
> +++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
> @@ -8024,11 +8024,66 @@
>
>  /// parseDirectiveEabiAttr
>  ///  ::= .eabi_attribute int, int
> +///  ::= .eabi_attribute Tag_name, int
>  bool ARMAsmParser::parseDirectiveEabiAttr(SMLoc L) {
> -  if (Parser.getTok().isNot(AsmToken::Integer))
> -    return Error(L, "integer expected");
> -  int64_t Tag = Parser.getTok().getIntVal();
> -  Parser.Lex(); // eat tag integer
> +  // Parse the eabi_attribute tag
> +  const AsmToken &Token = Parser.getTok();
> +  if (Token.isNot(AsmToken::Integer) && Token.isNot(AsmToken::Identifier))
> +    return Error(L, "eabi_attribute tag expected");
> +
> +  int Tag = -1;
> +  if (Token.is(AsmToken::Integer)) {
> +    Tag = Parser.getTok().getIntVal();
> +  } else {
> +    Tag = StringSwitch<int>(Token.getString())
> +#define CASE_EABI_ATTR_TAG(NAME) .Case("Tag_" #NAME, ARMBuildAttrs::NAME)
> +      CASE_EABI_ATTR_TAG(CPU_raw_name)
> +      CASE_EABI_ATTR_TAG(CPU_name)
> +      CASE_EABI_ATTR_TAG(CPU_arch)
> +      CASE_EABI_ATTR_TAG(CPU_arch_profile)
> +      CASE_EABI_ATTR_TAG(ARM_ISA_use)
> +      CASE_EABI_ATTR_TAG(THUMB_ISA_use)
> +      CASE_EABI_ATTR_TAG(FP_arch)
> +      CASE_EABI_ATTR_TAG(WMMX_arch)
> +      CASE_EABI_ATTR_TAG(Advanced_SIMD_arch)
> +      CASE_EABI_ATTR_TAG(PCS_config)
> +      CASE_EABI_ATTR_TAG(ABI_PCS_R9_use)
> +      CASE_EABI_ATTR_TAG(ABI_PCS_RW_data)
> +      CASE_EABI_ATTR_TAG(ABI_PCS_RO_data)
> +      CASE_EABI_ATTR_TAG(ABI_PCS_GOT_use)
> +      CASE_EABI_ATTR_TAG(ABI_PCS_wchar_t)
> +      CASE_EABI_ATTR_TAG(ABI_FP_rounding)
> +      CASE_EABI_ATTR_TAG(ABI_FP_denormal)
> +      CASE_EABI_ATTR_TAG(ABI_FP_exceptions)
> +      CASE_EABI_ATTR_TAG(ABI_FP_user_exceptions)
> +      CASE_EABI_ATTR_TAG(ABI_FP_number_model)
> +      CASE_EABI_ATTR_TAG(ABI_align8_needed)
> +      CASE_EABI_ATTR_TAG(ABI_align8_preserved)
> +      CASE_EABI_ATTR_TAG(ABI_enum_size)
> +      CASE_EABI_ATTR_TAG(ABI_HardFP_use)
> +      CASE_EABI_ATTR_TAG(ABI_VFP_args)
> +      CASE_EABI_ATTR_TAG(ABI_WMMX_args)
> +      CASE_EABI_ATTR_TAG(ABI_optimization_goals)
> +      CASE_EABI_ATTR_TAG(ABI_FP_optimization_goals)
> +      CASE_EABI_ATTR_TAG(compatibility)
> +      CASE_EABI_ATTR_TAG(CPU_unaligned_access)
> +      CASE_EABI_ATTR_TAG(FP_HP_extension)
> +      CASE_EABI_ATTR_TAG(ABI_FP_16bit_format)
> +      CASE_EABI_ATTR_TAG(MPextension_use)
> +      CASE_EABI_ATTR_TAG(DIV_use)
> +      CASE_EABI_ATTR_TAG(nodefaults)
> +      CASE_EABI_ATTR_TAG(also_compatible_with)
> +      CASE_EABI_ATTR_TAG(T2EE_use)
> +      CASE_EABI_ATTR_TAG(conformance)
> +      CASE_EABI_ATTR_TAG(Virtualization_use)
> +#undef CASE_EABI_ATTR_TAG
> +      .Case("Tag_VFP_arch", ARMBuildAttrs::FP_arch)
> +      .Default(-1);
> +
> +    if (Tag == -1)
> +      return Error(L, Twine("unknown eabi_attribute tag ",
> Token.getString()));
> +  }
> +  Parser.Lex(); // eat tag token
>
>    if (Parser.getTok().isNot(AsmToken::Comma))
>      return Error(L, "comma expected");
> Index: test/MC/ARM/directive-eabi_attribute-str.s
> ===================================================================
> --- /dev/null
> +++ test/MC/ARM/directive-eabi_attribute-str.s
> @@ -0,0 +1,86 @@
> +@ Check the mapping between Tag_names and build attribute number
> +
> +@ RUN: llvm-mc < %s -triple armv7-unknown-linux-gnueabi -o - | FileCheck
> %s
> +
> +@ FIXME: Special cases not supported by assembly parser at the moment.
> +@      .eabi_attribute Tag_CPU_raw_name, "cortex-a15"
> +@ FIXME-CHECK: .eabi_attribute 4, "cortex-a15"
> +@      .eabi_attribute Tag_CPU_name, "cortex-a15"
> +@ FIXME-CHECK: .eabi_attribute 5, "cortex-a15"
> +@      .eabi_attribute Tag_compatibility, 1, "aeabi"
> +@ FIXME-CHECK: .eabi_attribute 32, 1, "aeabi"
> +@      .eabi_attribute Tag_also_compatible_with, 1, ""
> +@ FIXME-CHECK: .eabi_attribute 65, 1, ""
> +@      .eabi_attribute Tag_conformance, "2.09"
> +@ FIXME-CHECK: .eabi_attribute 67, "2.09"
> +
> +       .eabi_attribute Tag_CPU_arch, 10
> +@ CHECK: .eabi_attribute 6, 10
> +       .eabi_attribute Tag_CPU_arch_profile, 65
> +@ CHECK: .eabi_attribute 7, 65
> +       .eabi_attribute Tag_ARM_ISA_use, 1
> +@ CHECK: .eabi_attribute 8, 1
> +       .eabi_attribute Tag_THUMB_ISA_use, 2
> +@ CHECK: .eabi_attribute 9, 2
> +       .eabi_attribute Tag_FP_arch, 5
> +@ CHECK: .eabi_attribute 10, 5
> +       .eabi_attribute Tag_VFP_arch, 5
> +@ CHECK: .eabi_attribute 10, 5
> +       .eabi_attribute Tag_WMMX_arch, 1
> +@ CHECK: .eabi_attribute 11, 1
> +       .eabi_attribute Tag_Advanced_SIMD_arch, 2
> +@ CHECK: .eabi_attribute 12, 2
> +       .eabi_attribute Tag_PCS_config, 2
> +@ CHECK: .eabi_attribute 13, 2
> +       .eabi_attribute Tag_ABI_PCS_R9_use, 2
> +@ CHECK: .eabi_attribute 14, 2
> +       .eabi_attribute Tag_ABI_PCS_RW_data, 1
> +@ CHECK: .eabi_attribute 15, 1
> +       .eabi_attribute Tag_ABI_PCS_RO_data, 1
> +@ CHECK: .eabi_attribute 16, 1
> +       .eabi_attribute Tag_ABI_PCS_GOT_use, 1
> +@ CHECK: .eabi_attribute 17, 1
> +       .eabi_attribute Tag_ABI_PCS_wchar_t, 2
> +@ CHECK: .eabi_attribute 18, 2
> +       .eabi_attribute Tag_ABI_FP_rounding, 1
> +@ CHECK: .eabi_attribute 19, 1
> +       .eabi_attribute Tag_ABI_FP_denormal, 1
> +@ CHECK: .eabi_attribute 20, 1
> +       .eabi_attribute Tag_ABI_FP_exceptions, 1
> +@ CHECK: .eabi_attribute 21, 1
> +       .eabi_attribute Tag_ABI_FP_user_exceptions, 1
> +@ CHECK: .eabi_attribute 22, 1
> +       .eabi_attribute Tag_ABI_FP_number_model, 1
> +@ CHECK: .eabi_attribute 23, 1
> +       .eabi_attribute Tag_ABI_align8_needed, 1
> +@ CHECK: .eabi_attribute 24, 1
> +       .eabi_attribute Tag_ABI_align8_preserved, 1
> +@ CHECK: .eabi_attribute 25, 1
> +       .eabi_attribute Tag_ABI_enum_size, 2
> +@ CHECK: .eabi_attribute 26, 2
> +       .eabi_attribute Tag_ABI_HardFP_use, 0
> +@ CHECK: .eabi_attribute 27, 0
> +       .eabi_attribute Tag_ABI_VFP_args, 1
> +@ CHECK: .eabi_attribute 28, 1
> +       .eabi_attribute Tag_ABI_WMMX_args, 1
> +@ CHECK: .eabi_attribute 29, 1
> +       .eabi_attribute Tag_ABI_optimization_goals, 2
> +@ CHECK: .eabi_attribute 30, 2
> +       .eabi_attribute Tag_ABI_FP_optimization_goals, 1
> +@ CHECK: .eabi_attribute 31, 1
> +       .eabi_attribute Tag_CPU_unaligned_access, 1
> +@ CHECK: .eabi_attribute 34, 1
> +       .eabi_attribute Tag_FP_HP_extension, 1
> +@ CHECK: .eabi_attribute 36, 1
> +       .eabi_attribute Tag_ABI_FP_16bit_format, 1
> +@ CHECK: .eabi_attribute 38, 1
> +       .eabi_attribute Tag_MPextension_use, 1
> +@ CHECK: .eabi_attribute 42, 1
> +       .eabi_attribute Tag_DIV_use, 2
> +@ CHECK: .eabi_attribute 44, 2
> +       .eabi_attribute Tag_nodefaults, 0
> +@ CHECK: .eabi_attribute 64, 0
> +       .eabi_attribute Tag_T2EE_use, 1
> +@ CHECK: .eabi_attribute 66, 1
> +       .eabi_attribute Tag_Virtualization_use, 2
> +@ CHECK: .eabi_attribute 68, 2
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131222/4e94f280/attachment.html>


More information about the llvm-commits mailing list