bfin.h (enum bfin_builtins): New.

* config/bfin/bfin.h (enum bfin_builtins): New.
	* config/bfin/bfin.md (UNSPEC_VOLATILE_CSYNC, UNSPEC_VOLATILE_SSYNC):
	New constants.
	(csync, ssync): New insn patterns.
	* config/bfin/bfin.c (bfin_init_builtins, bfin_expand_builtin):
	New functions.
	(def_builtin): New macro.
	(TARGET_INIT_BUILTINS, TARGET_EXPAND_BUILTIN): Define.

From-SVN: r100752
This commit is contained in:
Bernd Schmidt 2005-06-08 09:25:11 +00:00 committed by Bernd Schmidt
parent 71bc2a839d
commit 5fcead21e3
4 changed files with 85 additions and 1 deletions

View File

@ -3,6 +3,15 @@
* config/bfin/bfin.c (bfin_return_in_memory): Simplify; return
everything larger than 8 bytes in memory.
* config/bfin/bfin.h (enum bfin_builtins): New.
* config/bfin/bfin.md (UNSPEC_VOLATILE_CSYNC, UNSPEC_VOLATILE_SSYNC):
New constants.
(csync, ssync): New insn patterns.
* config/bfin/bfin.c (bfin_init_builtins, bfin_expand_builtin):
New functions.
(def_builtin): New macro.
(TARGET_INIT_BUILTINS, TARGET_EXPAND_BUILTIN): Define.
2005-06-08 Sebastian Pop <pop@cri.ensmp.fr>
* tree-data-ref.c (compute_estimated_nb_iterations,

View File

@ -2671,6 +2671,59 @@ bfin_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
output_asm_insn ("jump.l\t%P0", xops);
}
#define def_builtin(NAME, TYPE, CODE) \
do { \
builtin_function ((NAME), (TYPE), (CODE), BUILT_IN_MD, \
NULL, NULL_TREE); \
} while (0)
/* Set up all builtin functions for this target. */
static void
bfin_init_builtins (void)
{
tree void_ftype_void
= build_function_type (void_type_node, void_list_node);
/* Add the remaining MMX insns with somewhat more complicated types. */
def_builtin ("__builtin_bfin_csync", void_ftype_void, BFIN_BUILTIN_CSYNC);
def_builtin ("__builtin_bfin_ssync", void_ftype_void, BFIN_BUILTIN_SSYNC);
}
/* Expand an expression EXP that calls a built-in function,
with result going to TARGET if that's convenient
(and in mode MODE if that's convenient).
SUBTARGET may be used as the target for computing one of EXP's operands.
IGNORE is nonzero if the value is to be ignored. */
static rtx
bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
switch (fcode)
{
case BFIN_BUILTIN_CSYNC:
emit_insn (gen_csync ());
return 0;
case BFIN_BUILTIN_SSYNC:
emit_insn (gen_ssync ());
return 0;
default:
gcc_unreachable ();
}
}
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS bfin_init_builtins
#undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN bfin_expand_builtin
#undef TARGET_ASM_GLOBALIZE_LABEL
#define TARGET_ASM_GLOBALIZE_LABEL bfin_globalize_label

View File

@ -989,6 +989,14 @@ do { \
#define EXTRA_CONSTRAINT(VALUE, D) \
((D) == 'Q' ? GET_CODE (VALUE) == SYMBOL_REF : 0)
/* Codes for all the Blackfin builtins. */
enum bfin_builtins
{
BFIN_BUILTIN_CSYNC,
BFIN_BUILTIN_SSYNC,
BFIN_BUILTIN_MAX
};
/* `FINALIZE_PIC'
By generating position-independent code, when two different
programs (A and B) share a common library (libC.a), the text of

View File

@ -120,7 +120,9 @@
(UNSPEC_PUSH_MULTIPLE 5)])
(define_constants
[(UNSPEC_VOLATILE_EH_RETURN 0)])
[(UNSPEC_VOLATILE_EH_RETURN 0)
(UNSPEC_VOLATILE_CSYNC 1)
(UNSPEC_VOLATILE_SSYNC 2)])
(define_attr "type"
"move,mvi,mcld,mcst,dsp32,mult,alu0,shft,brcc,br,call,misc,compare,dummy"
@ -1838,6 +1840,18 @@
gcc_unreachable ();
})
(define_insn "csync"
[(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_CSYNC)]
""
"csync;"
[(set_attr "type" "misc")])
(define_insn "ssync"
[(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_SSYNC)]
""
"ssync;"
[(set_attr "type" "misc")])
;;; Vector instructions
(define_insn "addv2hi"