1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
/* $Id: declaration.h,v 1.72 2009/01/27 15:40:22 potyra Exp $
*
* Copyright (C) 2007-2009 FAUcc Team <info@faumachine.org>.
* This program is free software. You can redistribute it and/or modify it
* under the terms of the GNU General Public License, either version 2 of
* the License, or (at your option) any later version. See COPYING.
*/
#ifndef __DECLARATION_H_INCLUDED
#define __DECLARATION_H_INCLUDED
#include <inttypes.h>
#include "type.h"
/*
* Constants
*/
#define DECL_CLASS_NONE 0
#define DECL_CLASS_COUNT 32
#define DECL_REG_COUNT (DECL_CLASS_COUNT * 8)
#define DECL_MEMORY DECL_REG_COUNT
/*
* Types
*/
struct storage_register {
const char *name;
unsigned int class;
enum type_type type;
};
struct decl_live {
struct decl_live *prev;
struct decl_live *next;
struct declaration *decl;
};
struct declaration {
struct declaration *prev;
struct declaration *next;
const char *identifier;
enum type_storage {
STORAGE_NONE = 0,
STORAGE_AUTO,
STORAGE_STATIC,
STORAGE_TYPEDEF,
STORAGE_REGISTER,
STORAGE_EXTERN,
STORAGE_PARAM,
STORAGE_ASM,
} storage;
unsigned int mod_inline;
unsigned int attr_aligned;
unsigned int attr_noreturn;
struct expr *nbits;
struct expr *initializer;
struct stmt *stmt;
struct type *type_name;
const char *regname;
const char *code;
struct declaration *clone;
/* SSA Info */
struct expr *assign_expr;
unsigned int acount;
unsigned int wcount;
unsigned int rcount;
/* Register Allocation */
unsigned int storage_class;
int storage_mem;
unsigned int spills;
unsigned int reg_count[DECL_CLASS_COUNT];
struct decl_live *move_first;
struct decl_live *move_last;
struct decl_live *conflict_first;
struct decl_live *conflict_last;
struct decl_live *conflict_save_first;
struct decl_live *conflict_save_last;
unsigned int storage_register;
unsigned int offset;
/* FAUjitcc */
int jit;
};
/*
* Functions
*/
extern void
declaration_rename_structunionenum(
struct declaration *dion,
enum type_type type,
const char *old,
const char *new
);
extern void
declaration_rename_type(
struct declaration *dion,
const char *old,
const char *new);
extern struct declaration *
declaration_new(void);
extern void
declaration_name_set(struct declaration *d, const char *name);
extern const char *
declaration_name_get(struct declaration *dor);
extern void
declaration_type_get(struct type **adp, struct declaration *dor);
extern void
declaration_initializer_set(struct declaration *dor, struct expr *initializer);
extern struct expr *
declaration_initializer_get(struct declaration *dor);
extern struct declaration *
declaration_identifier(const char *name);
extern void
declaration_free(struct declaration *dor);
extern void
declaration_alive(struct storage_register *reginfo,
unsigned int *classinfo, unsigned int *typeinfo,
struct stmt *fs);
#endif /* __DECLARATION_H_INCLUDED */
|