/* Prototypes for exported functions defined in msp430.c
   
   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
   Contributed by Dmitry Diky <diwil@mail.ru>

   This file is part of GNU CC.

   GNU CC is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   GNU CC is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GNU CC; see the file COPYING.  If not, write to
   the Free Software Foundation, 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */


extern void bootloader_section (void);
extern void infomem_section (void);

extern void asm_file_start (FILE * file);
extern void asm_file_end (FILE * file);
extern void msp430_override_options (void);
/*extern void   function_prologue         (FILE *file, int size);
extern void   function_epilogue         (FILE *file, int size);*/
extern void gas_output_limited_string (FILE * file, const char *str);
extern void gas_output_ascii (FILE * file, const char *str, size_t length);
extern void order_regs_for_local_alloc (void);

int msp430_regno_ok_for_base_p (int reg, int strict);

int msp430_adjust_insn_length (rtx insn, int length);

#ifdef HAVE_MACHINE_MODES
extern int msp430_hard_regno_mode_ok (int regno, enum machine_mode mode);
#endif

extern int msp430_initial_elimination_offset (int, int);

#ifdef TREE_CODE
void msp430_asm_declare_function_name (FILE *, const char *, tree);
unsigned int msp430_section_type_flags (tree DECL, const char *NAME,
					int RELOC);

#ifdef RTX_CODE			/* inside TREE_CODE */
extern rtx msp430_function_arg (CUMULATIVE_ARGS * cum,
				enum machine_mode mode, tree type, int named);
extern void msp430_init_cumulative_args (CUMULATIVE_ARGS * cum,
					 tree fntype, rtx libname,
					 tree fndecl);
extern void msp430_init_cumulative_incoming_args (CUMULATIVE_ARGS * cum,
						  tree fntype, rtx libname);
extern rtx msp430_function_incoming_arg (CUMULATIVE_ARGS * cum,
					 enum machine_mode mode, tree type,
					 int named);



#endif /* RTX_CODE inside TREE_CODE */

#ifdef HAVE_MACHINE_MODES	/* inside TREE_CODE */
extern void msp430_function_arg_advance (CUMULATIVE_ARGS * cum,
					 enum machine_mode mode, tree type,
					 int named);
#endif /* HAVE_MACHINE_MODES inside TREE_CODE */
#endif /* TREE_CODE */

#ifdef RTX_CODE

int msp430_extract_multiword_operand (enum machine_mode innermode, rtx op,
				      rtx * parts);

extern void msp430_emit_cbranch (rtx operands[]);

extern int dead_or_set_in_peep (int, rtx, rtx);

const char *msp430_output_template (enum machine_mode mode,
				    int src_operand,
				    const char *init_op, const char *next_op);
const char *msp430_mov_noclobber (rtx operands[]);

enum reg_class msp430_regno_reg_class (int);

extern RTX_CODE followed_compare_condition (rtx);

extern const char *msp430_addsi_code (rtx insn, rtx operands[]);
extern const char *msp430_subsi_code (rtx insn, rtx operands[]);
extern const char *msp430_andsi_code (rtx insn, rtx operands[]);
extern const char *msp430_iorsi_code (rtx insn, rtx operands[]);
extern const char *msp430_xorsi_code (rtx insn, rtx operands[]);
extern const char *msp430_adddi_code (rtx insn, rtx operands[]);
extern const char *msp430_subdi_code (rtx insn, rtx operands[]);
extern const char *msp430_anddi_code (rtx insn, rtx operands[]);
extern const char *msp430_iordi_code (rtx insn, rtx operands[]);
extern const char *msp430_xordi_code (rtx insn, rtx operands[]);


extern int zero_shifted (rtx);

extern int msp430_vwa_general_operand (rtx, enum machine_mode);
extern int msp430_vwa_nonimmediate_operand (rtx, enum machine_mode);
extern int msp430_vwa_memory_operand (rtx, enum machine_mode);
extern int halfnibble_constant (rtx, enum machine_mode);
extern int halfnibble_integer (rtx, enum machine_mode);
extern int which_nibble (int);

extern const char *msp430_emit_abssi (rtx insn, rtx operands[]);
extern const char *msp430_emit_absdi (rtx insn, rtx operands[]);

extern const char *msp430_movstrhi_insn (rtx insn, rtx operands[]);
extern const char *msp430_clrstrhi_insn (rtx insn, rtx operands[]);

extern void msp430_expand_mov_intptr (rtx dest, rtx src);

extern int is_shift_better_in_reg (rtx operands[]);
extern const char *msp430_emit_ashlqi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_ashlhi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_ashlsi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_ashldi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_ashrqi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_ashrhi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_ashrsi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_ashrdi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_lshrqi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_lshrhi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_lshrsi3 (rtx insn, rtx operands[]);
extern const char *msp430_emit_lshrdi3 (rtx insn, rtx operands[]);

int msp430_extend_matches (const_rtx, const_rtx);
void msp430_expand_signextend (rtx operands[]);
void msp430_expand_zeroextend (rtx operands[]);

extern const char *msp430_emit_call (rtx operands[]);

const char *msp430_cbranch (rtx insn, rtx operands[]);

extern void msp430_notice_update_cc (rtx body, rtx insn);
extern int msp430_peep2_scratch_safe (rtx reg_rtx);
extern int test_hard_reg_class (enum reg_class rclass, rtx x);
extern void machine_dependent_reorg (rtx first_insn);
extern void msp430_output_addr_vec_elt (FILE * stream, int value);

extern int msp430_address_cost (rtx x);
extern int msp430_extra_constraint (rtx x, int c);
extern int default_rtx_costs (rtx X, RTX_CODE code, RTX_CODE outer_code,
			      bool);

extern void msp430_print_operand (FILE * file, rtx x, int code);
extern void msp430_print_operand_address (FILE * file, rtx addr);
extern int reg_unused_after (rtx insn, rtx reg);
extern int msp430_jump_dist (rtx x, rtx insn);
extern int call_insn_operand (rtx op, enum machine_mode mode);
extern int msp430_branch_mode (rtx x, rtx insn);

extern int msp430_expand_mul (rtx[], int);
extern int msp430_ashlhi3 (rtx[]);
extern int msp430_ashlsi3 (rtx[]);
extern int msp430_ashrhi3 (rtx[]);
extern int msp430_ashrsi3 (rtx[]);
extern int msp430_lshrhi3 (rtx[]);
extern int msp430_lshrsi3 (rtx[]);

extern void expand_prologue (void);
extern void expand_epilogue (void);
extern void msp430_set_current_function (tree);
extern int msp430_epilogue_uses (int regno);

#endif /* RTX_CODE */

#ifdef HAVE_MACHINE_MODES
extern int class_max_nregs (enum reg_class rclass, enum machine_mode mode);
#endif /* HAVE_MACHINE_MODES */

extern rtx msp430_return_addr_rtx (int, rtx);
