Hi,

I'm extending the i386 instructions by using the builtins in the backend.
And generate the builtin functions in the middle end. And would like
the generated builtin functions will be transformed to ASM code.

I tested the backend with a hand writing builtin functions, it *works*
well, but *not with* the middle end automatically generated functions.

1. In the middle end where l generate the builtin functions using the
following way:
  tree decl = build_decl (UNKNOWN_LOCATION,
                          FUNC_DECL, get_identifier (name), type);
  TREE_PUBLIC (decl) = 1;
  DECL_EXTERNAL (decl) = 1;
  DECL_BUILT_IN_CLASS (decl) = BUILT_IN_MD;

Here the BUILT_IN_MD is set to make sure the backend could catch and handle
for this situation.

2. In the backend, the builtin functions are defined using:
  def_builtin (OPTION_MASK_ISA_FOO, "__builtin_ia32_foo",
               VOID_FTYPE_VOID, IX86_BUILTIN_FOO);
And it'll works with the MD file to generate the ASM.

I'm not sure if I need some extra work to glue these together, but I think
since it works with a hand written file, it should work with the auto-generated
builtin functions in the middle end. Confused...

Any suggestions will be appreciated.

Thanks,
Feng

Reply via email to