view mc-codegen.h @ 935:7672a37e7545 default tip

Raspbery PI ARM support begin
author kono
date Sat, 24 Dec 2016 03:02:57 +0000
parents 553cd297b0a8
children
line wrap: on
line source

/* for mc-codegen.c */


/************************************************************************
** Copyright (C) 2006 Shinji Kono
** 連絡先: 琉球大学情報工学科 河野 真治  
** (E-Mail Address: kono@ie.u-ryukyu.ac.jp)
**
**    このソースのいかなる複写,改変,修正も許諾します。ただし、
**    その際には、誰が貢献したを示すこの部分を残すこと。
**    再配布や雑誌の付録などの問い合わせも必要ありません。
**    営利利用も上記に反しない範囲で許可します。
**    バイナリの配布の際にはversion messageを保存することを条件とします。
**    このプログラムについては特に何の保証もしない、悪しからず。
**
**    Everyone is permitted to do anything on this program 
**    including copying, modifying, improving,
**    as long as you don't try to pretend that you wrote it.
**    i.e., the above copyright notice has to appear in all copies.  
**    Binary distribution requires original version messages.
**    You don't have to ask before copying, redistribution or publishing.
**    THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
***********************************************************************/
extern int use;                /* generated value will be used in gexpr */
extern char *init_src;         /* internal defenition string for each file */

/* these architecture dependent values are defined in mc-code-*.c */

extern int size_of_pointer;
extern int size_of_int;
extern int size_of_short;
extern int size_of_float;
extern int size_of_double;
extern int size_of_longlong;
extern int size_of_vector;
extern int bit_of_byte;
extern int endian;
extern int struct_align;
extern int lp64;


#define USE_CREG (-1)
#define ASM_INPUT       1
#define ASM_OUTPUT      2
#define ASM_USED        3
#define MAX_ASM_REG     30

/* used by mc-parse */

extern NMTBL * def(NMTBL *n,int ctmode);
extern int arg_reorder(int arg,int new_arg);
extern void zfill(int var, int offset, int sz);
extern int assign_data(int e, int t, int v,int offset);
extern int assign_expr(int e1,int e2,int t);
extern int assign_expr0(int e1,int e2,int t,int type0);
extern int assop(int e1,int e2,int op,int t,int no_float);
extern int backdef(void);
extern int binop(int op, int e1, int e2, int t1, int t2);
extern int binop0(int op, int e1, int e2, int t1, int t2); // no inline
extern int cexpr(int e);
extern int cond(int t,int e1,int e2,int e3);
extern int correct_type(int e,int t);
extern int skip_cast(int e);
extern int csvalue();
extern int function_type(int e1,int *dots);
extern int gexpr(int e1,int use0);
extern int indop(int e);
extern int integral(int t);
extern int new_lvar(int size);
extern int new_lvar0(int sz, int align);
extern int rvalue(int e);
extern int rvalue_t(int e,int t);
extern int search_struct_type(int type,char *name,int *dsp);
extern int strop(int e,int ind);
extern void arg_register(NMTBL *fnptr, int in);
extern int bexpr(int e1, char cond, int l1);
extern void checkretpening(void);
extern void checkret(void);     // check delayed jump, delayed last exp
extern void closing();
extern void cmpdimm(int e, int csreg,int label,int cond);
extern void codegen_decl_init(); /* called before each declaration */
extern void codegen_init();      /* called only once */
extern void codegen_reinit();    /* called for each file */
extern void data_closing(int v,int type);
extern void df_label(int cslabel, int dlabel);
extern void emit_init_vars(void);
extern void fcheck(NMTBL *n);
extern void fdecl_struct(int fntype);
extern void free_lvar(int disp);
extern void gen_comment(char *s);
extern void gen_code_enter(char *name);
extern void gen_code_enter1(int args);
extern void gen_code_leave(char *name);
extern void gen_enter(char *name);
extern void gen_enter1();
extern void gen_jmp(int l);
extern void gen_indirect_goto(int e1);
extern void gen_leave(int control, char *name);
extern void init_free_lvar_list();
extern void lcheck(int e);
extern void opening(char *filename);
extern void parallel_rassign(int assigns);
extern void replace_return_struct(int func,int left);
extern void ret(void);
extern void gen_ret(void);
extern void gen_label_call(int l);
extern int gen_delayed_decl_data(int v,int offset);
extern void jump(int e,int env);
extern int arg_alignment(int disp0,NMTBL *n,int type0,int sz, int is_code);


/* used by mc-inline */

extern void checkjmp(int l);  // generate delayed jump, l = current label
extern int reference(int e1); // recover lvalue from rvalue of memory or register
extern int type_of_bop(int op);
extern int type_of_conv(int op);
extern int type_compatible(int t1, int t2);
extern int gen_decl_data(int e,int v);

/* used by mc-code-* */

extern int assign_expr0(int e1,int e2,int t,int type0) ;
extern int b_expr(int e1, char cond, int l1,int err);
extern int contains_p(int e,int (*p)(int));
extern int contains_p1(int arg,int e,int (*p)(int,int));
extern int contains_p2(int arg,int e,int (*p)(int,int));
extern void fwddef(int l);
extern int fwdlabel(void);
extern int g_expr(int e1);
extern int g_expr0(int e1);
extern int g_expr_u(int e1);
extern int is_const(int e);
extern int is_memory(int e);
extern int is_local_memory(int e1);
extern int is_code(NMTBL *fnptr);
extern int is_function(NMTBL *fnptr);
extern int is_inline(NMTBL *fnptr);
extern int scalar(int t);
extern unsigned make_mask(int from,int to);
extern unsigned long long make_mask_64(int from,int to);
extern void free_register_var(int reg_arg_list);

extern void init_ptr_cache();
extern void clear_ptr_cache_reg(int r);
extern int last_ptr_cache();
extern void clear_ptr_cache() ;
extern int get_ptr_cache(NMTBL *nptr);

// standard 32bit alignment
extern int code_arg_alignment0(int disp0,NMTBL *n,int type0,int sz, int is_code);
extern int code_lvar_alignment0(int disp0,NMTBL *n,int type0,int sz);

extern int ilog(int i);

extern char * nm(NMTBL *n) ;
extern int new_lvar_align(int size,int align);

/* used by mc-tree */

extern NMTBL str_ret;

/* used by conv  */
extern int rop_dual(int op);
extern int copy_expr(int e);



/* end */