PIPS
newgen_generic_function.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GENERIC_STATIC_OBJECT(PREFIX, name, type)
 Add the attribute ((unused)) for gcc to avoid warning if the functions are not used. More...
 
#define GENERIC_STATIC_STATUS(PREFIX, name, type, init, cloze)
 
#define GENERIC_FUNCTION(PREFIX, name, type)
 The idea here is to have a static function the name of which is name, and which is a newgen function (that is a ->). More...
 
#define GENERIC_LOCAL_FUNCTION(name, type)    GENERIC_FUNCTION(static, name, type)
 
#define GENERIC_GLOBAL_FUNCTION(name, type)    GENERIC_FUNCTION(extern, name, type)
 

Macro Definition Documentation

◆ GENERIC_FUNCTION

#define GENERIC_FUNCTION (   PREFIX,
  name,
  type 
)
Value:
GENERIC_STATIC_STATUS(PREFIX, name, type, make_##type(), free_##type) \
PREFIX void __attribute__ ((unused)) store_##name(type##_key_type k, type##_value_type v) { \
extend_##type(name##_object, k, v); \
} \
PREFIX void __attribute__ ((unused)) update_##name(type##_key_type k, type##_value_type v) { \
update_##type(name##_object, k, v); \
} \
PREFIX type##_value_type __attribute__ ((unused)) load_##name(type##_key_type k) { \
return(apply_##type(name##_object, k)); \
} \
PREFIX type##_value_type __attribute__ ((unused)) delete_##name(type##_key_type k) { \
return(delete_##type(name##_object, k)); \
} \
PREFIX bool __attribute__ ((unused)) bound_##name##_p(type##_key_type k) { \
return(bound_##type##_p(name##_object, k)); \
} \
PREFIX void __attribute__ ((unused)) store_or_update_##name(type##_key_type k, type##_value_type v) { \
if (bound_##name##_p(k)) \
update_##name(k, v); \
else \
store_##name(k, v); \
}
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
Definition: 3dnow.h:3
#define PREFIX
This phase checks for out of bound error when passing arrays or array elements as arguments in proced...
struct _newgen_struct_type_ * type
#define GENERIC_STATIC_STATUS(PREFIX, name, type, init, cloze)

The idea here is to have a static function the name of which is name, and which is a newgen function (that is a ->).

It embeds the status of some function related to the manipulated data, with the {INIT,SET,RESET,GET,CLOSE} functions. Plus the STORE, UPDATE and LOAD operators. and BOUND_P predicate. This could replace all generic_mappings in PIPS, if the mapping types are declared to newgen. It would also ease the db management. STORE and LOAD are prefered to extend and apply because it sounds like the generic mappings, and it feels as a status/static thing

Definition at line 72 of file newgen_generic_function.h.

◆ GENERIC_GLOBAL_FUNCTION

#define GENERIC_GLOBAL_FUNCTION (   name,
  type 
)     GENERIC_FUNCTION(extern, name, type)

Definition at line 99 of file newgen_generic_function.h.

◆ GENERIC_LOCAL_FUNCTION

#define GENERIC_LOCAL_FUNCTION (   name,
  type 
)     GENERIC_FUNCTION(static, name, type)

Definition at line 96 of file newgen_generic_function.h.

◆ GENERIC_STATIC_OBJECT

#define GENERIC_STATIC_OBJECT (   PREFIX,
  name,
  type 
)
Value:
static type name##_object = type##_undefined; \
PREFIX bool __attribute__ ((unused)) name##_undefined_p(void) { \
return name##_object==type##_undefined; \
} \
PREFIX void __attribute__ ((unused)) reset_##name(void) { \
message_assert("must reset sg defined", !name##_undefined_p()); \
name##_object=type##_undefined; \
} \
PREFIX void __attribute__ ((unused)) error_reset_##name(void) { \
name##_object=type##_undefined; \
} \
PREFIX void __attribute__ ((unused)) set_##name(type o) { \
message_assert("must set sg undefined", name##_undefined_p()); \
name##_object=o; \
} \
PREFIX type __attribute__ ((unused)) get_##name(void) { \
message_assert("must get sg defined", !name##_undefined_p()); \
return name##_object; \
}

Add the attribute ((unused)) for gcc to avoid warning if the functions are not used.

Definition at line 28 of file newgen_generic_function.h.

◆ GENERIC_STATIC_STATUS

#define GENERIC_STATIC_STATUS (   PREFIX,
  name,
  type,
  init,
  cloze 
)
Value:
PREFIX void __attribute__ ((unused)) init_##name(void) { \
message_assert("must initialize sg undefined", name##_undefined_p()); \
name##_object = init; \
} \
PREFIX void __attribute__ ((unused)) close_##name(void) { \
message_assert("must close sg defined", !name##_undefined_p()); \
cloze(name##_object); name##_object = type##_undefined; \
}
#define GENERIC_STATIC_OBJECT(PREFIX, name, type)
Add the attribute ((unused)) for gcc to avoid warning if the functions are not used.
static int init
Maximal value set for Fortran 77.
Definition: entity.c:320

Definition at line 49 of file newgen_generic_function.h.