|
PAPI
5.0.1.0
|

Go to the source code of this file.
Defines | |
| #define | PAPI_EVENTS_IN_DERIVED_EVENT 8 /* to satisfy papi_preset.h */ |
Enumerations | |
| enum | deftype_t { CDEFINE, F77DEFINE, F90DEFINE } |
Functions | |
| static void | define_val (const char *val_string, int val, enum deftype_t deftype) |
| static void | createDef (char *title, const hwi_describe_t *descr, int size, enum deftype_t deftype) |
| int | main (int argc, char **argv) |
Variables | |
| const hwi_describe_t | _papi_def [] |
| static char | comment_char = 'C' |
| #define PAPI_EVENTS_IN_DERIVED_EVENT 8 /* to satisfy papi_preset.h */ |
Definition at line 39 of file genpapifdef.c.
| enum deftype_t |
Definition at line 191 of file genpapifdef.c.
| static void createDef | ( | char * | title, |
| const hwi_describe_t * | descr, | ||
| int | size, | ||
| enum deftype_t | deftype | ||
| ) | [static] |
Definition at line 231 of file genpapifdef.c.
{
int i, j;
/* compute the size of the predefined array */
j = size / sizeof ( hwi_describe_t );
/* create defines for each line in the general arrays */
printf( "\n%c\n%c %s\n%c\n\n", comment_char, comment_char, title,
comment_char );
for ( i = 0; i < j; i++ )
define_val( descr[i].name, descr[i].value, deftype );
}


| static void define_val | ( | const char * | val_string, |
| int | val, | ||
| enum deftype_t | deftype | ||
| ) | [static] |
Definition at line 196 of file genpapifdef.c.
{
char value[20];
/* The Fortran spec defines negative numbers as the negation of a positive number.
Because of that definition, the largest possible 2's complement negative
number cannot be legally expressed in Fortran. Compiler behavior is undefined
and unpredictable on this issue.
Several FORTRAN compilers (GNU Fortran (GCC) > 4.2.3, others?)
will throw errors or warnings for an explicit numeric value of -2147483648,
However, they don't object to an arithmetic evaluation that produces the
desired value. This value happens to be used for the PAPI preset
PAPI_L1_DCM, and PAPI_DOM_HWSPEC.
The hack below works around that limitation.
*/
if ( ( ( unsigned ) val ) == 0x80000000 ) {
sprintf( value, "((-2147483647) - 1)" );
} else {
sprintf( value, "%d", val );
}
switch ( deftype ) {
case CDEFINE:
printf( "#define %-18s %s\n", val_string, value );
break;
case F77DEFINE:
printf( " INTEGER %-18s\n PARAMETER (%s=%s)\n", val_string,
val_string, value );
break;
case F90DEFINE:
printf( " INTEGER, PARAMETER :: %-18s = %s\n", val_string, value );
break;
}
}

| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 247 of file genpapifdef.c.
{
int i;
enum deftype_t deftype = CDEFINE;
if ( argc > 1 ) {
if ( strcmp( argv[1], "-f77" ) == 0 ) {
deftype = F77DEFINE;
comment_char = '!';
} else if ( strcmp( argv[1], "-f90" ) == 0 ) {
deftype = F90DEFINE;
comment_char = '!';
} else if ( strcmp( argv[1], "-c" ) == 0 ) {
deftype = CDEFINE;
comment_char = 'C';
} else {
fprintf( stderr, "Usage: %s [ -c | -f77 | -f90 ]\n", argv[0] );
exit( 1 );
}
}
/* print a file header block */
printf
( "%c\n%c This file contains defines required by the PAPI Fortran interface.\n",
comment_char, comment_char );
printf( "%c It is automagically generated by genpapifdef.c\n",
comment_char );
printf( "%c DO NOT modify its contents and expect the changes to stick.\n",
comment_char );
printf( "%c Changes MUST be made in genpapifdef.c instead.\n%c\n\n",
comment_char, comment_char );
/* create defines for the internal array pairs */
createDef( "General purpose defines.", _papi_def, sizeof ( _papi_def ),
deftype );
/* create defines for each member of the PRESET array */
printf( "\n%c\n%c PAPI preset event values.\n%c\n\n", comment_char,
comment_char, comment_char );
for ( i = 0; i < PAPI_MAX_PRESET_EVENTS; i++ ) {
if ( _papi_hwi_presets[i].symbol ) { /* if the event is in the preset table */
define_val( _papi_hwi_presets[i].symbol,
( i | PAPI_PRESET_MASK ), deftype );
}
}
exit( 0 );
}

| const hwi_describe_t _papi_def[] |
Definition at line 50 of file genpapifdef.c.
char comment_char = 'C' [static] |
Definition at line 193 of file genpapifdef.c.