PIPS
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "genC.h"
#include "newgen_include.h"
Go to the source code of this file.
Data Structures | |
struct | inlinable |
INLINE[] gives, for each inlinable (i.e., unboxed) type, its NAME, its initial VALUE and its printing FORMAT (for each language which can be a target. More... | |
Functions | |
__attribute__ ((__noreturn__)) | |
FATAL generates a fatal error by printing (according to FORMAT) the given MSG. More... | |
void | check_not_keyword (char *s) |
CHECK_NOT_KEYWORD checks if S isn't a reserved word. More... | |
void | init (void) |
INIT initializes global data structures. More... | |
int | max_domain_index () |
struct gen_binding * | lookup (char *name, int action) |
LOOKUP checks whether a given NAME is in the Domains table. More... | |
struct gen_binding * | new_binding (char *name, union domain *val) |
NEW_BINDING introduces a new pair (NAME, VAL) in the Domains table. More... | |
void | print_domainlist (out, l, op) |
PRINT_DOMAINLIST prints, in the OUT stream, the List of domains, bound together by an OPerator. More... | |
void | print_persistant (out, dp) |
void | print_domain (FILE *out, union domain *dp) |
PRINT_DOMAIN prints on the OUT stream a domain denoted by the DP pointer. More... | |
void | print_domains (FILE *out) |
PRINT_DOMAINS prints on the OUT stream the Domains table. More... | |
void | reconnect (int op, union domain *dp) |
void | compile (void) |
COMPILE reconnects the Domains table (for not compiled types – note that an inlined type is already compiled). More... | |
void | gen_write_spec (char *filename) |
GEN_WRITE_SPEC prints the Domains table in the given FILENAME. More... | |
int | build (int argc, char *argv[]) |
BUILD (in fact, the "main" function) parses the specifications and generates the manipulation functions. More... | |
char * | alloc (int size) |
ALLOC is an "iron-clad" version of malloc(3). More... | |
Variables | |
static char * | keywords [] |
int | Current_op |
Used to check, while parsing specs, that a constructed domain use only one operator type. More... | |
int | Current_start |
static char * | Op_names [] |
Warning: this table knows about the actual values used for AND_OP and OR_OP. More... | |
int | error_seen |
Have we seen a user error somewhere ? More... | |
static int | max_domain = -1 |
static int | current_first |
RECONNECT replaces the (STRUCT BINDING *) members of the DP domain which are, on entry, strings by their effective values, i.e. More... | |
__attribute__ | ( | (__noreturn__) | ) |
FATAL generates a fatal error by printing (according to FORMAT) the given MSG.
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
If there already is a user error, let's suppose that's her fault !
Definition at line 82 of file build.c.
References abort, and fprintf().
char* alloc | ( | int | size | ) |
ALLOC is an "iron-clad" version of malloc(3).
Definition at line 501 of file build.c.
References fatal(), i2a(), and malloc().
Referenced by chunk_for_domain(), copy_obj_in(), freia_memory_management_statement(), gen_alloc(), gen_cons(), gen_copy_array(), gen_copy_list(), gen_init_tabulated(), gen_make_array(), gen_sort_list(), gtt_make(), hash_enlarge_table(), hash_map_put(), hash_table_generic_make(), init_array(), make_ref(), new_local_image_variable(), push_gen_trav_env(), and set_generic_make().
BUILD (in fact, the "main" function) parses the specifications and generates the manipulation functions.
RGSUSED
Definition at line 483 of file build.c.
References compile(), error_seen, gen_write_spec(), gencode(), genspec_parse(), init(), and user().
Referenced by main().
void check_not_keyword | ( | char * | s | ) |
void compile | ( | void | ) |
COMPILE reconnects the Domains table (for not compiled types – note that an inlined type is already compiled).
set size of domain.
Definition at line 422 of file build.c.
References ARRAY_DT, domain::ba, BASIS_DT, domain::co, gen_binding::compiled, domain::components, domain::constructand, CONSTRUCTED_DT, current_first, gen_binding::domain, Domains, EXTERNAL_DT, gen_size(), IS_TABULATED, LIST_DT, MAX_DOMAIN, gen_binding::name, print_domains(), reconnect(), SET_DT, gen_binding::size, Tabulated_bp, domain::type, and user().
Referenced by build(), gen_read_spec(), and opencl_compile_mergeable_dag().
void gen_write_spec | ( | char * | filename | ) |
GEN_WRITE_SPEC prints the Domains table in the given FILENAME.
Definition at line 464 of file build.c.
References domain::filename, print_domains(), return(), and user().
Referenced by build().
void init | ( | void | ) |
INIT initializes global data structures.
FC: formats are directly inlined in genClib...
Tabulated_bp hack is statically allocated here.
Definition at line 130 of file build.c.
References domain::ar, ARRAY_DT, domain::ba, gen_binding::compiled, domain::constructor, Current_op, Current_start, domain::dimensions, gen_binding::domain, Domains, domain::element, error_seen, gen_binding::inlined, MAX_DOMAIN, inlinable::name, gen_binding::name, gen_binding::size, gen_binding::tabulated, Tabulated_bp, domain::type, UNDEF_OP, and UNIT_TYPE_NAME.
Referenced by build().
struct gen_binding* lookup | ( | char * | name, |
int | action | ||
) |
LOOKUP checks whether a given NAME is in the Domains table.
If not, the ACTION says whether this is an error or it should be introduced. If this is for a new gen_binding, look in the current allocation range, else from beginning
Definition at line 191 of file build.c.
References Current_start, Domains, fatal(), i2a(), max_domain, MAX_DOMAIN, gen_binding::name, NEW_BINDING, OLD_BINDING, and user().
Referenced by new_binding(), and reconnect().
int max_domain_index | ( | ) |
Definition at line 181 of file build.c.
References max_domain.
Referenced by gen_check().
struct gen_binding* new_binding | ( | char * | name, |
union domain * | val | ||
) |
NEW_BINDING introduces a new pair (NAME, VAL) in the Domains table.
Redeclaration is allowed if this is to overwrite a previous IMPORT definition. Note that we could (should ?) check that this new gen_binding isn't a new (and incompatible) IMPORT definition.
Definition at line 230 of file build.c.
References domain::ba, gen_binding::domain, Domains, EXTERNAL_DT, fprintf(), free(), IMPORT_DT, lookup(), gen_binding::name, NEW_BINDING, OLD_BINDING, Read_spec_mode, domain::type, and user().
void print_domain | ( | FILE * | out, |
union domain * | dp | ||
) |
PRINT_DOMAIN prints on the OUT stream a domain denoted by the DP pointer.
This is done before the compilation so (STRUCT BINDING *) members are still strings.
Definition at line 294 of file build.c.
References domain::ar, ARRAY_DT, domain::ba, BASIS_DT, domain::co, domain::components, domain::constructand, CONSTRUCTED_DT, domain::constructor, domain::dimensions, Domains, domain::element, EXTERNAL_DT, fatal(), domain::filename, fprintf(), i2a(), domain::im, IMPORT_DT, domain::li, LIST_DT, gen_binding::name, domain::op, out, print_domainlist(), print_persistant(), domain::se, SET_DT, and domain::type.
Referenced by defined_null(), gen_trav_obj(), gen_trav_simple(), print_domainlist(), and print_domains().
void print_domainlist | ( | out | , |
l | , | ||
op | |||
) |
PRINT_DOMAINLIST prints, in the OUT stream, the List of domains, bound together by an OPerator.
Definition at line 265 of file build.c.
References fatal(), fprintf(), Op_names, out, and print_domain().
Referenced by print_domain().
void print_domains | ( | FILE * | out | ) |
PRINT_DOMAINS prints on the OUT stream the Domains table.
Inlined domains aren't printed.
if( (dp=bp->domain)->ba.type==CONSTRUCTED_DT && dp->co.op==OR_OP) (void)fprintf( out, "--NEWGEN-FIRST %d\n", dp->co.first ) ;
Definition at line 352 of file build.c.
References gen_binding::domain, Domains, fprintf(), IS_EXTERNAL, IS_IMPORT, IS_INLINABLE, IS_TABULATED, MAX_DOMAIN, gen_binding::name, out, print_domain(), and Tabulated_bp.
Referenced by compile(), and gen_write_spec().
void print_persistant | ( | out | , |
dp | |||
) |
Definition at line 281 of file build.c.
References domain::ba, fprintf(), out, and domain::persistant.
Referenced by print_domain().
Definition at line 384 of file build.c.
References domain::ar, ARRAY_DT, domain::ba, BASIS_DT, domain::co, domain::components, domain::constructand, CONSTRUCTED_DT, current_first, domain::element, EXTERNAL_DT, fatal(), domain::first, i2a(), IMPORT_DT, domain::li, LIST_DT, lookup(), OLD_BINDING, domain::op, OR_OP, Read_spec_mode, return(), domain::se, SET_DT, and domain::type.
Referenced by compile().
|
static |
RECONNECT replaces the (STRUCT BINDING *) members of the DP domain which are, on entry, strings by their effective values, i.e.
pointers in the Domains table which have the corresponding names.
FIRST members for OR_OP (checked with OP) domains are updated.
Definition at line 382 of file build.c.
Referenced by compile(), and reconnect().
int Current_op |
Used to check, while parsing specs, that a constructed domain use only one operator type.
Definition at line 62 of file build.c.
Referenced by init(), and update_op().
int error_seen |
Have we seen a user error somewhere ?
Definition at line 76 of file build.c.
Referenced by build(), gen_consistent_p(), gen_defined_p(), and init().
|
static |
Definition at line 53 of file build.c.
Referenced by check_not_keyword().
|
static |
Definition at line 179 of file build.c.
Referenced by lookup(), and max_domain_index().
|
static |
Warning: this table knows about the actual values used for AND_OP and OR_OP.
Definition at line 67 of file build.c.
Referenced by print_domainlist().