Skip to content

Commit fe5bda9

Browse files
authored
Merge pull request #458 from ThePortlandGroup/nv_stage
Pull 2018-05-02T18-42 Recent NVIDIA Changes
2 parents f4ec466 + b34481c commit fe5bda9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2185
-1113
lines changed

tools/flang1/flang1exe/func.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5585,7 +5585,7 @@ inline_small_matmul(int ast, int dest)
55855585
AD_UPBD(ad, 1) = AD_UPAST(ad, 1) = mk_cval(jextent, DT_INT);
55865586
AD_EXTNTAST(ad, 1) = AD_UPBD(ad, 1);
55875587
}
5588-
sptr = get_arr_temp(dtnew, TRUE, FALSE);
5588+
sptr = get_arr_temp(dtnew, TRUE, FALSE, FALSE);
55895589
trans_mkdescr(sptr);
55905590
dest = mk_id(sptr);
55915591
}

tools/flang1/flang1exe/semant.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13132,6 +13132,8 @@ clear_ident_list()
1313213132
}
1313313133
ident_base[hashval] = 0;
1313413134
}
13135+
13136+
dirty_ident_base = FALSE;
1313513137
}
1313613138

1313713139
static void

tools/flang1/flang1exe/semant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ ACL *dinit_struct_vals(ACL *, DTYPE, SPTR);
981981
SPTR get_temp(DTYPE);
982982
DTYPE get_temp_dtype(DTYPE, int);
983983
SPTR get_itemp(DTYPE);
984-
SPTR get_arr_temp(DTYPE, LOGICAL, LOGICAL);
984+
SPTR get_arr_temp(DTYPE, LOGICAL, LOGICAL, LOGICAL);
985985
SPTR get_adjlr_arr_temp(DTYPE);
986986
int get_shape_arr_temp(int);
987987
SPTR get_ch_temp(DTYPE);

tools/flang1/flang1exe/semant3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5498,7 +5498,7 @@ gen_derived_arr_init(int arr_dtype, int strt_std, int end_std)
54985498
int i;
54995499
int std;
55005500

5501-
sptr = get_arr_temp(arr_dtype, FALSE, FALSE);
5501+
sptr = get_arr_temp(arr_dtype, FALSE, FALSE, FALSE);
55025502
subscr_ast = mk_id(sptr);
55035503

55045504
/* gen subscr'd temp */

tools/flang1/flang1exe/semfunc.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ func_call2(SST *stktop, ITEM *list, int flag)
10851085
shaper = A_SHAPEG(ARG_AST(i));
10861086
if (shaper) {
10871087
int dt = dtype_with_shape(dtype, shaper);
1088-
fval_sptr = get_arr_temp(dt, FALSE, FALSE);
1088+
fval_sptr = get_arr_temp(dt, FALSE, FALSE, FALSE);
10891089
DTYPEP(fval_sptr, dt);
10901090
STYPEP(fval_sptr, ST_ARRAY);
10911091
break;
@@ -1663,7 +1663,7 @@ ptrfunc_call(SST *stktop, ITEM *list)
16631663
shaper = A_SHAPEG(ARG_AST(i));
16641664
if (shaper) {
16651665
int dt = dtype_with_shape(dtype, shaper);
1666-
fval_sptr = get_arr_temp(dt, FALSE, FALSE);
1666+
fval_sptr = get_arr_temp(dt, FALSE, FALSE, FALSE);
16671667
DTYPEP(fval_sptr, dt);
16681668
STYPEP(fval_sptr, ST_ARRAY);
16691669
break;
@@ -2466,10 +2466,10 @@ precompute_arg_intrin(int dscptr, int nactuals)
24662466
if (AD_DEFER(ad) || AD_ADJARR(ad) || AD_NOBOUNDS(ad)) {
24672467
tmp = get_shape_arr_temp(arg);
24682468
} else
2469-
tmp = get_arr_temp(dtype, FALSE, TRUE);
2469+
tmp = get_arr_temp(dtype, FALSE, TRUE, FALSE);
24702470
}
24712471
} else
2472-
tmp = get_arr_temp(dtype, FALSE, TRUE);
2472+
tmp = get_arr_temp(dtype, FALSE, TRUE, FALSE);
24732473
} else {
24742474
dtype = get_temp_dtype(dtype, arg);
24752475
tmp = get_temp(dtype);
@@ -5337,10 +5337,10 @@ ref_intrin(SST *stktop, ITEM *list)
53375337
if (AD_DEFER(ad) || AD_ADJARR(ad) || AD_NOBOUNDS(ad)) {
53385338
tmp = get_shape_arr_temp(ARG_AST(0));
53395339
} else
5340-
tmp = get_arr_temp(dtype1, FALSE, TRUE);
5340+
tmp = get_arr_temp(dtype1, FALSE, TRUE, FALSE);
53415341
}
53425342
} else
5343-
tmp = get_arr_temp(dtype1, FALSE, TRUE);
5343+
tmp = get_arr_temp(dtype1, FALSE, TRUE, FALSE);
53445344

53455345
} else {
53465346
dtype1 = get_temp_dtype(dtype1, ARG_AST(0));
@@ -6314,7 +6314,7 @@ ref_pd(SST *stktop, ITEM *list)
63146314
ad = AD_DPTR(dtyper);
63156315
AD_UPBD(ad, 0) = AD_UPAST(ad, 0) =
63166316
mk_isz_cval(rank_of_ast(ARG_AST(0)), astb.bnd.dtype);
6317-
tmp = get_arr_temp(dtyper, FALSE, FALSE);
6317+
tmp = get_arr_temp(dtyper, FALSE, FALSE, FALSE);
63186318
arrtmp_ast = mk_id(tmp);
63196319
shaper = A_SHAPEG(arrtmp_ast);
63206320
ARG_AST(0) = arrtmp_ast; /* first argument is temp */
@@ -6615,7 +6615,7 @@ ref_pd(SST *stktop, ITEM *list)
66156615
ad = AD_DPTR(dtyper);
66166616
AD_UPBD(ad, 0) = AD_UPAST(ad, 0) =
66176617
mk_isz_cval(rank_of_ast(ARG_AST(0)), astb.bnd.dtype);
6618-
tmp = get_arr_temp(dtyper, FALSE, FALSE);
6618+
tmp = get_arr_temp(dtyper, FALSE, FALSE, FALSE);
66196619
arrtmp_ast = mk_id(tmp);
66206620
shaper = A_SHAPEG(arrtmp_ast);
66216621
ARG_AST(0) = arrtmp_ast; /* first argument is temp */
@@ -7063,7 +7063,7 @@ ref_pd(SST *stktop, ITEM *list)
70637063
tmp_dtype = dtype_with_shape(DDTG(dtype2), A_SHAPEG(SST_ASTG(stkp)));
70647064
}
70657065

7066-
tmp = get_arr_temp(tmp_dtype, FALSE, FALSE);
7066+
tmp = get_arr_temp(tmp_dtype, FALSE, FALSE, FALSE);
70677067
arrtmp_ast = mk_id(tmp);
70687068
ast = mk_assn_stmt(arrtmp_ast, SST_ASTG(stkp), tmp_dtype);
70697069
(void)add_stmt(ast);
@@ -7201,7 +7201,7 @@ ref_pd(SST *stktop, ITEM *list)
72017201
mk_isz_cval(count, astb.bnd.dtype);
72027202
shape1 = A_SHAPEG(ARG_AST(0));
72037203
argt_count = 3 * count + 2;
7204-
tmp = get_arr_temp(dtyper, FALSE, FALSE);
7204+
tmp = get_arr_temp(dtyper, FALSE, FALSE, FALSE);
72057205
arrtmp_ast = mk_id(tmp);
72067206
shaper = A_SHAPEG(arrtmp_ast);
72077207
sptr = find_pointer_variable(ARG_AST(0));
@@ -7572,7 +7572,7 @@ ref_pd(SST *stktop, ITEM *list)
75727572
break;
75737573
case TY_DERIVED:
75747574
if (shaper)
7575-
arrtmp_ast = mk_id(get_arr_temp(dtyper, FALSE, FALSE));
7575+
arrtmp_ast = mk_id(get_arr_temp(dtyper, FALSE, FALSE, FALSE));
75767576
else
75777577
arrtmp_ast = mk_id(get_temp(dtyper));
75787578
func_ast = begin_call(A_ICALL, hpf_sym, 6);
@@ -8578,7 +8578,7 @@ ref_pd(SST *stktop, ITEM *list)
85788578
DTY(dtyper + 1) = dtype2;
85798579

85808580
shaper = mkshape(dtyper);
8581-
arrtmp_ast = mk_id(get_arr_temp(dtyper, FALSE, FALSE));
8581+
arrtmp_ast = mk_id(get_arr_temp(dtyper, FALSE, FALSE, FALSE));
85828582
ARGT_ARG(argt, 0) = arrtmp_ast;
85838583

85848584
dtype1 = DDTG(SST_DTYPEG(ARG_STK(0)));

tools/flang1/flang1exe/semsym.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ refsym_inscope(int first, OVCLASS oclass)
995995
*/
996996
goto return0;
997997
}
998-
if (gbl.internal > 1 && !INTERNALG(sptr)) {
998+
if (gbl.internal > 1 && !INTERNALG(sptr) && !IS_INTRINSIC(STYPEG(sptr))) {
999999
/* declare a new symbol: existing one is not internal but we
10001000
* are in an internal subprogram */
10011001
goto return0;

tools/flang1/flang1exe/semutil2.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ init_sptr_w_acl(int in_sptr, ACL *aclp)
16711671
if (sem.arrdim.ndefer) {
16721672
ALLOCATE_ARRAYS = 0; /* allocate for these array temps is done here */
16731673
}
1674-
sptr = acs.tmp = get_arr_temp(acs.arrtype, FALSE, FALSE);
1674+
sptr = acs.tmp = get_arr_temp(acs.arrtype, FALSE, FALSE, FALSE);
16751675
ALLOCATE_ARRAYS = 1;
16761676
if (sem.arrdim.ndefer) {
16771677
sem.bounds[0].lwast = astb.bnd.one;
@@ -2367,7 +2367,7 @@ mkexpr_assign_temp(SST *stkptr)
23672367
a temporary so that we can subscript it. */
23682368
if (DTY(dtype = SST_DTYPEG(stkptr)) == TY_ARRAY && !simple) {
23692369
dtype = get_shape_arraydtype(A_SHAPEG(ast), DTY(dtype + 1));
2370-
id = get_arr_temp(dtype, FALSE, FALSE);
2370+
id = get_arr_temp(dtype, FALSE, FALSE, FALSE);
23712371
if (sem.arrdim.ndefer)
23722372
gen_allocate_array(id);
23732373
ast = ast_rewrite_indices(ast);
@@ -7370,7 +7370,7 @@ allocate_temp(SPTR sptr)
73707370
/** \brief Get a compiler array temporary of type dtype.
73717371
*/
73727372
SPTR
7373-
get_arr_temp(DTYPE dtype, LOGICAL nodesc, LOGICAL alloc_deferred)
7373+
get_arr_temp(DTYPE dtype, LOGICAL nodesc, LOGICAL alloc_deferred, LOGICAL constructor)
73747374
{
73757375
SPTR sptr;
73767376
int needalloc;
@@ -7421,7 +7421,16 @@ get_arr_temp(DTYPE dtype, LOGICAL nodesc, LOGICAL alloc_deferred)
74217421
tmpc = TEMPS_CTR(1);
74227422
else
74237423
tmpc = TEMPS_STK(1);
7424-
sptr = getcctmp_sc('a', tmpc, ST_ARRAY, dtype, sc);
7424+
if (constructor)
7425+
/* Creating a temporary for an array constructor within an OpenACC region.
7426+
* Mark this by using letter 'x' in the name of the temporary so that it
7427+
* can be identified by the accelerator backend.
7428+
* Caution: Any change to this naming scheme must also be reflected in
7429+
* routine add_implicit_private in accel.c.
7430+
*/
7431+
sptr = getcctmp_sc('x', tmpc, ST_ARRAY, dtype, sc);
7432+
else
7433+
sptr = getcctmp_sc('a', tmpc, ST_ARRAY, dtype, sc);
74257434
dt = DTYPEG(sptr);
74267435
if (DTY(dt + 1) == DTY(dtype + 1) && ADD_DEFER(dtype) == ADD_DEFER(dt) &&
74277436
nodesc == NODESCG(sptr) && conformable(dt, dtype))
@@ -7462,7 +7471,7 @@ get_adjlr_arr_temp(DTYPE dtype)
74627471
{
74637472
SPTR sptr;
74647473
ALLOCATE_ARRAYS = 0; /* no need to generate an allocate of the temp*/
7465-
sptr = get_arr_temp(dtype, TRUE, FALSE);
7474+
sptr = get_arr_temp(dtype, TRUE, FALSE, FALSE);
74667475
ALLOCATE_ARRAYS = 1;
74677476
return sptr;
74687477
}
@@ -7474,7 +7483,7 @@ get_shape_arr_temp(int arg)
74747483
{
74757484
int shape = A_SHAPEG(arg);
74767485
DTYPE dtype = get_shape_arraydtype(shape, DTY(A_DTYPEG(arg) + 1));
7477-
SPTR tmp = get_arr_temp(dtype, FALSE, FALSE);
7486+
SPTR tmp = get_arr_temp(dtype, FALSE, FALSE, FALSE);
74787487
if (sem.arrdim.ndefer)
74797488
gen_allocate_array(tmp);
74807489
return tmp;
@@ -7677,7 +7686,7 @@ sem_tempify(SST *stkptr)
76777686
if (DTY(argtyp) != TY_ARRAY) {
76787687
tmpsym = get_temp(argtyp);
76797688
} else {
7680-
tmpsym = get_arr_temp(argtyp, FALSE, A_SHAPEG(SST_ASTG(stkptr)));
7689+
tmpsym = get_arr_temp(argtyp, FALSE, A_SHAPEG(SST_ASTG(stkptr)), FALSE);
76817690
}
76827691
mkident(&tmpsst);
76837692
SST_SYMP(&tmpsst, tmpsym);

tools/flang1/flang1exe/symacc.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
#define STANDARD_MAXIDLEN MAXIDLEN
4545
#endif
4646

47+
extern STB stb;
48+
extern GBL gbl;
49+
static char buff[132];
50+
4751
void
4852
sym_init_first(void)
4953
{
@@ -398,87 +402,83 @@ add_fp_constants(void)
398402
#endif
399403
}
400404

401-
LOGICAL
405+
bool
402406
is_flt0(SPTR sptr)
403407
{
404408
if (sptr == stb.flt0 || sptr == stb.fltm0)
405-
return TRUE;
406-
return FALSE;
409+
return true;
410+
return false;
407411
}
408412

409-
LOGICAL
413+
bool
410414
is_dbl0(SPTR sptr)
411415
{
412416
if (sptr == stb.dbl0 || sptr == stb.dblm0)
413-
return TRUE;
414-
return FALSE;
417+
return true;
418+
return false;
415419
}
416420

417-
LOGICAL
421+
bool
418422
is_quad0(SPTR sptr)
419423
{
420424
if (sptr == stb.quad0 || sptr == stb.quadm0)
421-
return TRUE;
422-
return FALSE;
425+
return true;
426+
return false;
423427
}
424428

425429
#ifdef LONG_DOUBLE_FLOAT128
430+
bool
426431
is_float128_0(SPTR sptr)
427432
{
428433
return sptr == stb.float128_0 || sptr == stb.float128_m0;
429434
}
430435
#endif /* LONG_DOUBLE_FLOAT128 */
431436

432-
LOGICAL
437+
bool
433438
is_cmplx_flt0(SPTR sptr)
434439
{
435440
if (CONVAL1G(sptr) == CONVAL2G(stb.flt0) ||
436441
CONVAL1G(sptr) == CONVAL2G(stb.fltm0)) {
437442
if (CONVAL2G(sptr) == CONVAL2G(stb.flt0) ||
438443
CONVAL2G(sptr) == CONVAL2G(stb.fltm0)) {
439-
return TRUE;
444+
return true;
440445
}
441446
}
442-
return FALSE;
447+
return false;
443448
}
444449

445-
LOGICAL
450+
bool
446451
is_creal_flt0(SPTR sptr)
447452
{
448453
if (CONVAL1G(sptr) == CONVAL2G(stb.flt0) ||
449454
CONVAL1G(sptr) == CONVAL2G(stb.fltm0))
450-
return TRUE;
451-
return FALSE;
455+
return true;
456+
return false;
452457
}
453458

454-
LOGICAL
459+
bool
455460
is_cimag_flt0(SPTR sptr)
456461
{
457462
if (CONVAL2G(sptr) == CONVAL2G(stb.flt0) ||
458463
CONVAL2G(sptr) == CONVAL2G(stb.fltm0))
459-
return TRUE;
460-
return FALSE;
464+
return true;
465+
return false;
461466
}
462467

463-
LOGICAL
468+
bool
464469
is_cmplx_dbl0(SPTR sptr)
465470
{
466471
if (is_dbl0(CONVAL1G(sptr)) && is_dbl0(CONVAL2G(sptr)))
467-
return TRUE;
468-
return FALSE;
472+
return true;
473+
return false;
469474
}
470475

471-
LOGICAL
476+
bool
472477
is_cmplx_quad0(SPTR sptr)
473478
{
474-
if (is_quad0(CONVAL1G(sptr)) && is_quad0(CONVAL2G(sptr)))
475-
return TRUE;
476-
return FALSE;
479+
return is_quad0(CONVAL1G(sptr)) && is_quad0(CONVAL2G(sptr));
477480
}
478481

479-
STB stb;
480-
GBL gbl;
481-
static char buff[132];
482482
void
483483
symini_errfatal(int n)
484484
{

tools/flang1/flang1exe/symacc.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ template <typename T, typename Index> class IndexBy
5959
#define INDEX_BY(T, Index) T *
6060
#endif
6161

62-
#ifdef __cplusplus
62+
#if defined(__cplusplus) && !defined(HACK_EAS)
6363
extern "C" {
6464
#endif
65+
6566
/* FIXME: down the file there are declarations that depend on ST_MAX
6667
etc. and not guarded by #ifdef INIT. Either INIT is always
6768
defined or there exist alternative definitions for these values
@@ -245,25 +246,25 @@ SPTR installsym_ex(const char *name, int olength, IS_MODE mode);
245246
int putsname(const char *, int);
246247
char *local_sname(char *);
247248
void add_fp_constants(void);
248-
LOGICAL is_flt0(int);
249-
LOGICAL is_dbl0(int);
250-
LOGICAL is_quad0(int);
251-
LOGICAL is_x87_0(int);
252-
LOGICAL is_doubledouble_0(int);
253-
LOGICAL is_cmplx_flt0(int);
254-
LOGICAL is_creal_flt0(int);
255-
LOGICAL is_cimag_flt0(int);
256-
LOGICAL is_cmplx_dbl0(int);
257-
LOGICAL is_cmplx_quad0(int);
258-
LOGICAL is_cmplx_x87_0(int);
259-
LOGICAL is_cmplx_doubledouble_0(int);
249+
bool is_flt0(SPTR sptr);
250+
bool is_dbl0(SPTR sptr);
251+
bool is_quad0(SPTR sptr);
252+
bool is_x87_0(SPTR sptr);
253+
bool is_doubledouble_0(SPTR sptr);
254+
bool is_cmplx_flt0(SPTR sptr);
255+
bool is_creal_flt0(SPTR sptr);
256+
bool is_cimag_flt0(SPTR sptr);
257+
bool is_cmplx_dbl0(SPTR sptr);
258+
bool is_cmplx_quad0(SPTR sptr);
259+
bool is_cmplx_x87_0(SPTR sptr);
260+
bool is_cmplx_doubledouble_0(SPTR sptr);
260261

261262
void put_err(int sev, const char *txt);
262263

263264
void symini_errfatal(int n);
264265
void symini_error(int n, int s, int l, const char *c1, const char *c2);
265266
void symini_interr(const char *txt, int val, int sev);
266267

267-
#ifdef __cplusplus
268+
#if defined(__cplusplus) && !defined(HACK_EAS)
268269
}
269270
#endif

0 commit comments

Comments
 (0)