[fd4df379] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2023 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
| 7 | // boxed.hfa -- inter-compile unit dependencies and common macros for the "array boxed" test |
---|
| 8 | // |
---|
| 9 | // Author : Mike Brooks |
---|
| 10 | // Created On : Thu Jul 25 17:00:00 2024 |
---|
| 11 | // Last Modified By : |
---|
| 12 | // Last Modified On : |
---|
| 13 | // Update Count : |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | // See general test documentation in boxed.main.cfa. |
---|
| 17 | // See abbreviation definitions in boxed.cases.hfa. |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #ifdef SUPPRESS_INIT |
---|
| 21 | #define DECTYVAR(T) T* |
---|
| 22 | #define INITARR @= {} |
---|
| 23 | #else |
---|
| 24 | #define DECTYVAR(T) T |
---|
| 25 | #define INITARR |
---|
| 26 | #endif |
---|
| 27 | |
---|
| 28 | // ETG definitions |
---|
| 29 | #define ID(TY) TY |
---|
| 30 | #define PAIR(TY) pair(TY, TY) |
---|
| 31 | |
---|
| 32 | #define DECL( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ); |
---|
| 33 | |
---|
| 34 | #define CALL( F_SLUG, TRID, SZS, SZV, ... ) CALL__SZS_ ## SZS( F_SLUG, TRID, SZV, __VA_ARGS__ ) |
---|
| 35 | #define CALL__SZS_NSTAT( F_SLUG, TRID, SZV, ... ) F_NAME_NSTAT( F_SLUG, TRID ) ( __VA_ARGS__ ) |
---|
| 36 | #define CALL__SZS_NDYN( F_SLUG, TRID, SZV, ... ) F_NAME_NDYN( F_SLUG, TRID ) ( __VA_ARGS__, SZV ) |
---|
| 37 | |
---|
| 38 | #define F_SIG( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__SPS_ ## SPS( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 39 | #define F_SIG__SPS_NA( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_SMPL( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 40 | #define F_SIG__SPS_PPD( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_SMPL( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 41 | #define F_SIG__SPS_PPA( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_ASSN( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 42 | #define F_SIG__SPS_PMA( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_ASSN( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 43 | #define F_SIG__SPS_MPD( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_NONE( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 44 | #define F_SIG__POLY_SMPL( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_SMPL__SZS_ ## SZS( F_SLUG, TRID, SZV, ACCS, SPS, OVLD ) |
---|
| 45 | #define F_SIG__POLY_SMPL__SZS_NSTAT(F_SLUG, TRID, SZV, ACCS, SPS, OVLD ) forall( DECTYVAR(T) ) OVLD * F_NAME_NSTAT(F_SLUG, TRID ) ( size_t expectedElmSz, const char * tcid, const char * vart ) |
---|
| 46 | #define F_SIG__POLY_SMPL__SZS_NDYN( F_SLUG, TRID, SZV, ACCS, SPS, OVLD ) forall( DECTYVAR(T) ) OVLD * F_NAME_NDYN( F_SLUG, TRID ) ( size_t expectedElmSz, const char * tcid, const char * vart, size_t n ) |
---|
| 47 | #define F_SIG__POLY_ASSN( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_ASSN__SZS_ ## SZS( F_SLUG, TRID, SZV, ACCS, SPS, OVLD ) |
---|
| 48 | #define F_SIG__POLY_ASSN__SZS_NSTAT(F_SLUG, TRID, SZV, ACCS, SPS, OVLD ) forall( DECTYVAR(T) | { DECL_ACCESS( F_SLUG, TRID, ACCS, SPS, SZV ) } ) OVLD * F_NAME_NSTAT(F_SLUG, TRID) ( size_t expectedElmSz, const char * tcid, const char * vart ) |
---|
| 49 | #define F_SIG__POLY_NONE( F_SLUG, TRID, SZS, SZV, ACCS, SPS, OVLD ) F_SIG__POLY_NONE__SZS_ ## SZS( F_SLUG, TRID, SZV, ACCS, SPS, OVLD ) |
---|
| 50 | #define F_SIG__POLY_NONE__SZS_NSTAT(F_SLUG, TRID, SZV, ACCS, SPS, OVLD ) OVLD * F_NAME_NSTAT(F_SLUG, TRID) ( size_t expectedElmSz, const char * tcid, const char * vart ) |
---|
| 51 | |
---|
| 52 | #define F_NAME_NSTAT( F_SLUG, TRID ) F_SLUG ## _ ## TRID |
---|
| 53 | #define F_NAME_NDYN( F_SLUG, TRID ) F_SLUG ## _ ## TRID |
---|
| 54 | |
---|
| 55 | #define DECL_ACCESS( F_SLUG, TRID, ACCS, SPS, SZ ) void F_NAME_NSTAT( access, TRID ) ( size_t, ACCESS_PARM_TY(ACCS, SZ) ); |
---|
| 56 | #define ACCESS_PARM_TY(ACCS, SZ) ACCESS_PARM_TY__ACCS_ ## ACCS( SZ ) |
---|
| 57 | #define ACCESS_PARM_TY__ACCS_PFST(SZ) T * |
---|
| 58 | #define ACCESS_PARM_TY__ACCS_PARR(SZ) T (*)[SZ] |
---|
| 59 | |
---|
| 60 | // Used as the "polymorphic, but not T" element type. |
---|
| 61 | forall(U, V) |
---|
| 62 | struct pair { |
---|
| 63 | U fst; |
---|
| 64 | V snd; |
---|
| 65 | }; |
---|
| 66 | |
---|
| 67 | // Used as the "larger than a pointer" element type. |
---|
| 68 | // Size chosen empirically to give buffers larger than the whole stack frame |
---|
| 69 | // for a pointer-sized element. |
---|
| 70 | struct bigun { |
---|
| 71 | long long int a; |
---|
| 72 | long long int b; |
---|
| 73 | long long int c; |
---|
| 74 | long long int d; |
---|
| 75 | long long int e; |
---|
| 76 | }; |
---|
| 77 | |
---|
| 78 | // Verbose output is unstable from one compiler-target-optimization to another. |
---|
| 79 | // So it can't run in the overnight test. But it helps see what went wrong. |
---|
| 80 | #ifdef VERBOSE |
---|
| 81 | #define VPRT(...) printf(__VA_ARGS__) |
---|
| 82 | #else |
---|
| 83 | #define VPRT(...) |
---|
| 84 | #endif |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | // defined in bookend.cfa |
---|
| 90 | |
---|
| 91 | void bookendInner( void ); |
---|
| 92 | |
---|
| 93 | #define TC(...) |
---|
| 94 | #define TR( TRID, SZS, SZV, ETG, ACCS, SPS, OVLD ) DECL( bookendOuter, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 95 | #include "boxed.cases.hfa" |
---|
| 96 | #undef TC |
---|
| 97 | #undef TR |
---|
| 98 | |
---|
| 99 | void resetBookends( void ); |
---|
| 100 | void reportBookends( void ); |
---|
| 101 | |
---|
| 102 | extern char * ar_hi; |
---|
| 103 | extern char * ar_lo; |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | // defined in main.cfa |
---|
| 108 | |
---|
| 109 | #define TC(...) |
---|
| 110 | #define TR( TRID, SZS, SZV, ETG, ACCS, SPS, OVLD ) DECL( allocAndAccess, TRID, SZS, SZV, ACCS, SPS, OVLD ) |
---|
| 111 | #include "boxed.cases.hfa" |
---|
| 112 | #undef TC |
---|
| 113 | #undef TR |
---|