Skip to content

Commit

Permalink
Merge pull request #104 from ThePortlandGroup/nv_stage
Browse files Browse the repository at this point in the history
Pull 2017-06-20T13-48 Recent NVIDIA Changes
  • Loading branch information
sscalpone authored Jun 20, 2017
2 parents 6c3cb9c + 673b141 commit 6d6ef35
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 21 deletions.
27 changes: 27 additions & 0 deletions tools/flang1/flang1exe/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -2653,6 +2653,33 @@ mk_shared_extent(int lb, int ub, int dim)
return extent;
}

/* \brief returns TRUE if type of ast is a symbol or an object that can be
* passed to sym_of_ast() or memsym_of_ast() functions.
*
* \param ast is the AST to test.
*
* \returns TRUE if ast is suitable for sym_of_ast(), etc. Otherwise FALSE.
*/
LOGICAL
ast_is_sym(int ast)
{
if (A_ALIASG(ast))
return TRUE;
switch (A_TYPEG(ast)) {
case A_ID:
case A_LABEL:
case A_ENTRY:
case A_SUBSCR:
case A_SUBSTR:
case A_MEM:
case A_FUNC:
return TRUE;
case A_CONV:
return ast_is_sym(A_LOPG(ast));
}
return FALSE;
}

/** \brief Like memsym_of_ast(), but for a member, returns the sptr of its
parent, not the member.
*/
Expand Down
16 changes: 16 additions & 0 deletions tools/flang1/flang1exe/semant2.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,22 @@ semant2(int rednum, SST *top)
if (XBIT(49, 0x400000))
check_derived_type_array_section(SST_ASTG(RHS(1)));
SST_PARENP(LHS, 0);
ast = SST_ASTG(RHS(1));
if (ast_is_sym(ast)) {
/* If this <var ref> is a procedure pointer expression, then we
* need to propagate the dtype from the procedure pointer's interface
* if it's a function.
*/
int mem = memsym_of_ast(ast);
if (is_procedure_ptr(mem)) {
int iface = 0;
proc_arginfo(mem, NULL, NULL, &iface);
if (FVALG(iface) && (dtype = DTYPEG(iface)) ) {
SST_DTYPEP(LHS, dtype);
}
}
}

break;
/*
* <primary> ::= <constant> |
Expand Down
4 changes: 2 additions & 2 deletions tools/flang1/flang1exe/semtbp.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ semCheckTbp(tbpTask task, TBP *curr, char *impName)
sym = iface ? iface : curr->impSptr;
if (curr->isInherited) {
/* use inherited (parent's) sym if this type bound
* procedure is not overloaded.
*/
* procedure is not overloaded.
*/
parent = curr->dtype;
parent = DTYPEG(PARENTG(get_struct_tag_sptr(parent)));
mem = 0;
Expand Down
1 change: 1 addition & 0 deletions tools/flang1/utils/ast/ast.in.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,4 @@ int rewrite_ast_with_new_dtype(int ast, DTYPE dtype);
int get_ast_extents(int extent_asts[], int from_ast, DTYPE arr_dtype);
int add_extent_subscripts(int to_ast, int rank, const int extent_asts[], DTYPE elt_dtype);
int add_shapely_subscripts(int to_ast, int from_ast, DTYPE arr_dtype, DTYPE elt_dtype);
LOGICAL ast_is_sym(int ast);
4 changes: 4 additions & 0 deletions tools/flang2/docs/xflag.n
Original file line number Diff line number Diff line change
Expand Up @@ -5303,6 +5303,10 @@ More accelerator flags
Windows compilation flag -ot12 was used, pass it on to pgnvd so as to use OpenTools 12.
.XB 0x02:
Deep copy of complex data structures.
.XB 0x04:
Array members and subscription address demoting when Mlarge_arrays is enabled.
.XB 0x10:
Dynamic scheduling for gangs.

.XF "216:"
FLANG flags
Expand Down
2 changes: 1 addition & 1 deletion tools/flang2/flang2exe/cgmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -7891,7 +7891,7 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
"pow_d", operand, make_lltype_from_dtype(DT_DBLE), NULL, I_CALL);
break;
case IL_DPOWI:
// TODO: won't work because our builtins expect args in regiters (xxm0 in
// TODO: won't work because our builtins expect args in registers (xxm0 in
// ths case) and
// the call generated here (with llc) puts the args on the stack
assert(ILI_ALT(ilix),
Expand Down
7 changes: 2 additions & 5 deletions tools/flang2/flang2exe/exp_rte.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,8 @@ exp_type_bound_proc_call(int arg, int descno, int vtoff, int arglnk)
ili = ad3ili(IL_AADD, ili, ad_aconi(func_offset), 0);
ili = ad2ili(IL_LDA, ili, NME_UNK);
} else if (SCG(sym) != SC_DUMMY) {
v[0] = 0;
v[1] = type_offset;
con = getcon(v, DT_INT);
acon = get_acon(sym, get_isz_cval(con));
ili = ad1ili(IL_ACON, acon);
ili = mk_address(sym);
ili = ad3ili(IL_AADD, ili, ad_aconi(type_offset), 0);
ili = ad2ili(IL_LDA, ili, NME_UNK);
ili = ad3ili(IL_AADD, ili, ad_aconi(vft_offset), 0);
ili = ad2ili(IL_LDA, ili, NME_UNK);
Expand Down
5 changes: 4 additions & 1 deletion tools/flang2/flang2exe/expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,10 @@ expand(void)
EXP_FREE(expb.ilmb);
freearea(STR_AREA);
if (flg.opt < 2) {
EXP_FREE(rcandb);
if (rcandb.stg_base) {
EXP_FREE(rcandb);
rcandb.stg_base = NULL;
}
}
share_proc_ili = TRUE;
exp_smp_fini();
Expand Down
6 changes: 0 additions & 6 deletions tools/flang2/flang2exe/expatomics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,6 @@ exp_end_atomic(int store, int curilm)
} else if (atomic_opcode != IL_FREEIR) {
int atomic_seq;
atomic_seq = create_atomic_seq(store);
iltb.callfg = 1;
chk_block(atomic_seq);
ILM_RESULT(curilm) = atomic_seq;
ILM_BLOCK(curilm) = expb.curbih;
Expand All @@ -1449,7 +1448,6 @@ exp_end_atomic(int store, int curilm)
} else if (atomic_opcode != IL_FREEIR) {
int atomic_seq;
atomic_seq = create_atomic_read_seq(store);
iltb.callfg = 1;
chk_block(atomic_seq);
ILM_RESULT(curilm) = atomic_seq;
ILM_BLOCK(curilm) = expb.curbih;
Expand All @@ -1471,7 +1469,6 @@ exp_end_atomic(int store, int curilm)
} else if (atomic_opcode != IL_FREEIR) {
int atomic_seq;
atomic_seq = create_atomic_write_seq(store);
iltb.callfg = 1;
chk_block(atomic_seq);
ILM_RESULT(curilm) = atomic_seq;
ILM_BLOCK(curilm) = expb.curbih;
Expand Down Expand Up @@ -1499,7 +1496,6 @@ exp_end_atomic(int store, int curilm)
* not first. */
atomic_seq = create_atomic_capture_seq(capture_update_ili,
capture_read_ili, 0);
iltb.callfg = 1;
chk_block(atomic_seq);
ILM_RESULT(curilm) = atomic_seq;
ILM_BLOCK(curilm) = expb.curbih;
Expand All @@ -1521,7 +1517,6 @@ exp_end_atomic(int store, int curilm)
int atomic_seq;
atomic_seq = create_atomic_capture_seq(capture_update_ili,
capture_read_ili, 1);
iltb.callfg = 1;
chk_block(atomic_seq);
ILM_RESULT(curilm) = atomic_seq;
ILM_BLOCK(curilm) = expb.curbih;
Expand All @@ -1531,7 +1526,6 @@ exp_end_atomic(int store, int curilm)
/* Set the result of the FREEIR ILM to the regular
* storage element (basically, a fallthrough).
*/
iltb.callfg = 1;
chk_block(store);
ILM_RESULT(curilm) = store;
ILM_BLOCK(curilm) = expb.curbih;
Expand Down
7 changes: 3 additions & 4 deletions tools/flang2/flang2exe/lili2llvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,21 @@
void *
llgetlldtype(int dtype, int addrspace)
{
interr("unimplemeted llgetlldtype() called", 0, 4);
interr("unimplemented llgetlldtype() called", 0, 4);
return 0;
}

void *
get_current_l2l_module()
{
interr("unimplemeted get_current_l2l_module() called", 0, 4);
interr("unimplemented get_current_l2l_module() called", 0, 4);
return 0;
}

void *
get_current_module()
{

interr("unimplemeted get_module() called", 0, 4);
interr("unimplemented get_current_module() called", 0, 4);
return 0;
}

3 changes: 1 addition & 2 deletions tools/flang2/flang2exe/upper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1981,8 +1981,7 @@ read_symbol(void)
namelist = getbit("namelist"); /* + */
optional = getbit("optional"); /* + */
pointer = getbit("pointer"); /* + */
private
= getbit("private"); /* + */
private = getbit("private"); /* + */
pdaln = getval("pdaln"); /* + */
tqaln = getbit("tqaln"); /* + */
ref = getbit("ref");
Expand Down

0 comments on commit 6d6ef35

Please sign in to comment.