Skip to content

Commit

Permalink
Rename ili_get_vect_type() to ili_get_vect_dtype()
Browse files Browse the repository at this point in the history
to disambiguate the type system being accessed.
  • Loading branch information
tskeith committed Dec 6, 2017
1 parent bdb9f18 commit 24e0ec3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
40 changes: 20 additions & 20 deletions tools/flang2/flang2exe/cgmain.c
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2010-2017, NVIDIA CORPORATION. All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -3485,7 +3485,7 @@ make_stmt(STMT_Type stmt_type, int ilix, LOGICAL deletable, int next_bih_label,
LL_Type *int_llt = NULL; LL_Type *int_llt = NULL;
LL_Type *v4_llt = NULL; LL_Type *v4_llt = NULL;
msz = ILI_MSZ_OF_ST(ilix); msz = ILI_MSZ_OF_ST(ilix);
vect_dtype = ili_get_vect_type(ilix); vect_dtype = ili_get_vect_dtype(ilix);
#if defined(TARGET_LLVM_ARM) #if defined(TARGET_LLVM_ARM)
if (vect_dtype) { if (vect_dtype) {
store_flags = ldst_instr_flags_from_dtype(vect_dtype); store_flags = ldst_instr_flags_from_dtype(vect_dtype);
Expand Down Expand Up @@ -4354,7 +4354,7 @@ gen_minmax_expr(int ilix, OPERAND *op1, OPERAND *op2)
DBGTRACEIN2(" ilix: %d(%s)", ilix, IL_NAME(opc)) DBGTRACEIN2(" ilix: %d(%s)", ilix, IL_NAME(opc))


operand = make_tmp_op(NULL, make_tmps()); operand = make_tmp_op(NULL, make_tmps());
vect_dtype = ili_get_vect_type(ilix); vect_dtype = ili_get_vect_dtype(ilix);
if (vect_dtype) { if (vect_dtype) {
llt = make_lltype_from_dtype(vect_dtype); llt = make_lltype_from_dtype(vect_dtype);
operand->ll_type = llt->sub_types[0]; operand->ll_type = llt->sub_types[0];
Expand Down Expand Up @@ -4891,7 +4891,7 @@ gen_convert_vector(int ilix)
static OPERAND * static OPERAND *
gen_binary_vexpr(int ilix, int itype_int, int itype_uint, int itype_float) gen_binary_vexpr(int ilix, int itype_int, int itype_uint, int itype_float)
{ {
DTYPE vect_dtype = ili_get_vect_type(ilix); DTYPE vect_dtype = ili_get_vect_dtype(ilix);
assert(vect_dtype, assert(vect_dtype,
"gen_binary_vexpr(): called with non vector type for ilix ", ilix, 4); "gen_binary_vexpr(): called with non vector type for ilix ", ilix, 4);
switch (DTY(DTY(vect_dtype + 1))) { switch (DTY(DTY(vect_dtype + 1))) {
Expand Down Expand Up @@ -5331,7 +5331,7 @@ gen_binary_expr(int ilix, int itype)
OPERAND *bit_mask_of_ones; OPERAND *bit_mask_of_ones;
DTYPE vdt; DTYPE vdt;
SPTR vcon1_sptr; SPTR vcon1_sptr;
vect_dtype = ili_get_vect_type(lhs_ili); vect_dtype = ili_get_vect_dtype(lhs_ili);
binops = gen_llvm_expr(lhs_ili,0); binops = gen_llvm_expr(lhs_ili,0);
num_elem = DTY(vect_dtype + 2); num_elem = DTY(vect_dtype + 2);
vdt = get_vector_type(DT_INT,num_elem); vdt = get_vector_type(DT_INT,num_elem);
Expand All @@ -5357,7 +5357,7 @@ gen_binary_expr(int ilix, int itype)
lhs_ili = ad_kconi(-1); lhs_ili = ad_kconi(-1);
break; break;
case IL_VNOT: case IL_VNOT:
vect_dtype = ili_get_vect_type(ilix); vect_dtype = ili_get_vect_dtype(ilix);
switch (DTY(DTY(vect_dtype + 1))) { switch (DTY(DTY(vect_dtype + 1))) {
case TY_INT8: case TY_INT8:
case TY_UINT8: case TY_UINT8:
Expand Down Expand Up @@ -5406,7 +5406,7 @@ gen_binary_expr(int ilix, int itype)
assert(0, "gen_binary_expr(): confusion with opcode", opc, 4); assert(0, "gen_binary_expr(): confusion with opcode", opc, 4);
} }
} }
vect_dtype = ili_get_vect_type(ilix); vect_dtype = ili_get_vect_dtype(ilix);
if (vect_dtype) { if (vect_dtype) {
instr_type = make_lltype_from_dtype(vect_dtype); instr_type = make_lltype_from_dtype(vect_dtype);
} else } else
Expand Down Expand Up @@ -7139,7 +7139,7 @@ gen_vsincos_return_type(LL_Type *vecTy)
INLINE static OPERAND * INLINE static OPERAND *
gen_llvm_vsincos_call(int ilix) gen_llvm_vsincos_call(int ilix)
{ {
const DTYPE dtype = ili_get_vect_type(ilix); const DTYPE dtype = ili_get_vect_dtype(ilix);
LL_Type *floatTy = make_lltype_from_dtype(DT_FLOAT); LL_Type *floatTy = make_lltype_from_dtype(DT_FLOAT);
LL_Type *vecTy = make_lltype_from_dtype(dtype); LL_Type *vecTy = make_lltype_from_dtype(dtype);
DTYPE dtypeName = (vecTy->sub_types[0] == floatTy) ? DT_FLOAT : DT_DBLE; DTYPE dtypeName = (vecTy->sub_types[0] == floatTy) ? DT_FLOAT : DT_DBLE;
Expand Down Expand Up @@ -8368,21 +8368,21 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
operand = gen_call_llvm_intrinsic( operand = gen_call_llvm_intrinsic(
intrinsic_name, intrinsic_name,
gen_llvm_expr(ILI_OPND(ilix, 1), gen_llvm_expr(ILI_OPND(ilix, 1),
make_lltype_from_dtype(ili_get_vect_type(ilix))), make_lltype_from_dtype(ili_get_vect_dtype(ilix))),
make_lltype_from_dtype(ILI_OPND(ilix, 2)), NULL, I_PICALL); make_lltype_from_dtype(ILI_OPND(ilix, 2)), NULL, I_PICALL);
break; break;
case IL_VSQRT: case IL_VSQRT:
intrinsic_name = vect_llvm_intrinsic_name(ilix); intrinsic_name = vect_llvm_intrinsic_name(ilix);
operand = gen_call_llvm_intrinsic( operand = gen_call_llvm_intrinsic(
intrinsic_name, intrinsic_name,
gen_llvm_expr(ILI_OPND(ilix, 1), gen_llvm_expr(ILI_OPND(ilix, 1),
make_lltype_from_dtype(ili_get_vect_type(ilix))), make_lltype_from_dtype(ili_get_vect_dtype(ilix))),
make_lltype_from_dtype(ili_get_vect_type(ilix)), NULL, I_PICALL); make_lltype_from_dtype(ili_get_vect_dtype(ilix)), NULL, I_PICALL);
break; break;
case IL_VRSQRT: { case IL_VRSQRT: {
int vsize; int vsize;
const int arg = ILI_OPND(ilix, 1); const int arg = ILI_OPND(ilix, 1);
dtype = ili_get_vect_type(ilix); /* get the vector dtype */ dtype = ili_get_vect_dtype(ilix); /* get the vector dtype */
intrinsic_type = make_lltype_from_dtype(dtype); intrinsic_type = make_lltype_from_dtype(dtype);
assert(TY_ISVECT(DTY(dtype)), "gen_llvm_expr(): expected vect type", assert(TY_ISVECT(DTY(dtype)), "gen_llvm_expr(): expected vect type",
DTY(dtype), ERR_Fatal); DTY(dtype), ERR_Fatal);
Expand Down Expand Up @@ -8418,7 +8418,7 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
case IL_VRCP: { case IL_VRCP: {
int vsize; int vsize;
const int arg = ILI_OPND(ilix, 1); const int arg = ILI_OPND(ilix, 1);
dtype = ili_get_vect_type(ilix); /* get the vector dtype */ dtype = ili_get_vect_dtype(ilix); /* get the vector dtype */
intrinsic_type = make_lltype_from_dtype(dtype); intrinsic_type = make_lltype_from_dtype(dtype);
assert(TY_ISVECT(DTY(dtype)), "gen_llvm_expr(): expected vect type", assert(TY_ISVECT(DTY(dtype)), "gen_llvm_expr(): expected vect type",
DTY(dtype), ERR_Fatal); DTY(dtype), ERR_Fatal);
Expand Down Expand Up @@ -8456,7 +8456,7 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
case IL_VFMA3: case IL_VFMA3:
case IL_VFMA4: case IL_VFMA4:
intrinsic_name = vect_llvm_intrinsic_name(ilix); intrinsic_name = vect_llvm_intrinsic_name(ilix);
intrinsic_type = make_lltype_from_dtype(ili_get_vect_type(ilix)); intrinsic_type = make_lltype_from_dtype(ili_get_vect_dtype(ilix));
args = gen_llvm_expr(ILI_OPND(ilix, 1), intrinsic_type); args = gen_llvm_expr(ILI_OPND(ilix, 1), intrinsic_type);
args->next = gen_llvm_expr(ILI_OPND(ilix, 2), intrinsic_type); args->next = gen_llvm_expr(ILI_OPND(ilix, 2), intrinsic_type);
args->next->next = gen_llvm_expr(ILI_OPND(ilix, 3), intrinsic_type); args->next->next = gen_llvm_expr(ILI_OPND(ilix, 3), intrinsic_type);
Expand All @@ -8468,7 +8468,7 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
break; break;
case IL_VCOS: case IL_VCOS:
case IL_VSIN: { case IL_VSIN: {
LL_Type *vecTy = make_lltype_from_dtype(ili_get_vect_type(ilix)); LL_Type *vecTy = make_lltype_from_dtype(ili_get_vect_dtype(ilix));
if (ILI_OPC(ILI_OPND(ilix, 1)) == IL_VSINCOS) { if (ILI_OPC(ILI_OPND(ilix, 1)) == IL_VSINCOS) {
// overloaded use: this is an extract value operation // overloaded use: this is an extract value operation
LL_Type *retTy = gen_vsincos_return_type(vecTy); LL_Type *retTy = gen_vsincos_return_type(vecTy);
Expand Down Expand Up @@ -8512,7 +8512,7 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
} break; } break;
case IL_VMIN: case IL_VMIN:
case IL_VMAX: { case IL_VMAX: {
int vect_dtype = ili_get_vect_type(ilix); int vect_dtype = ili_get_vect_dtype(ilix);
OPERAND *op1, *op2; OPERAND *op1, *op2;
LL_Type *llTy; LL_Type *llTy;
lhs_ili = ILI_OPND(ilix, 2); lhs_ili = ILI_OPND(ilix, 2);
Expand Down Expand Up @@ -8721,7 +8721,7 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
{ {
OPERAND *op1; OPERAND *op1;
LL_Type *vect_lltype; LL_Type *vect_lltype;
DTYPE vect_dtype = ili_get_vect_type(ilix); DTYPE vect_dtype = ili_get_vect_dtype(ilix);
int mask_ili; int mask_ili;


/* LLVM shufflevector instruction has a mask whose selector takes /* LLVM shufflevector instruction has a mask whose selector takes
Expand All @@ -8743,7 +8743,7 @@ gen_llvm_expr(int ilix, LL_Type *expected_type)
int num_elem; int num_elem;
OPERAND *op1; OPERAND *op1;
LL_Type *vect_lltype, *int_type, *select_type; LL_Type *vect_lltype, *int_type, *select_type;
DTYPE vect_dtype = ili_get_vect_type(ilix); DTYPE vect_dtype = ili_get_vect_dtype(ilix);
int mask_ili = ILI_OPND(ilix,1); int mask_ili = ILI_OPND(ilix,1);
lhs_ili = ILI_OPND(ilix, 2); lhs_ili = ILI_OPND(ilix, 2);
rhs_ili = ILI_OPND(ilix, 3); rhs_ili = ILI_OPND(ilix, 3);
Expand Down Expand Up @@ -8933,7 +8933,7 @@ gen_vect_compare_operand(int mask_ili)
incoming_cc_code = ILI_OPND(mask_ili,1); incoming_cc_code = ILI_OPND(mask_ili,1);
lhs_ili = ILI_OPND(mask_ili,2); lhs_ili = ILI_OPND(mask_ili,2);
rhs_ili = ILI_OPND(mask_ili,3); rhs_ili = ILI_OPND(mask_ili,3);
vect_dtype = ili_get_vect_type(mask_ili); vect_dtype = ili_get_vect_dtype(mask_ili);
elem_dtype = DTY(vect_dtype + 1); elem_dtype = DTY(vect_dtype + 1);
num_elem = DTY(vect_dtype + 2); num_elem = DTY(vect_dtype + 2);


Expand Down Expand Up @@ -8979,7 +8979,7 @@ vect_llvm_intrinsic_name(int ilix)
ILI_OP opc = ILI_OPC(ilix); ILI_OP opc = ILI_OPC(ilix);
char *basename, *retc; char *basename, *retc;
assert(IL_VECT(opc), "vect_llvm_intrinsic_name(): not vect ili", ilix, 4); assert(IL_VECT(opc), "vect_llvm_intrinsic_name(): not vect ili", ilix, 4);
dtype = ili_get_vect_type(ilix); dtype = ili_get_vect_dtype(ilix);


assert(DTY(dtype) == TY_VECT, "vect_llvm_intrinsic_name(): not vect dtype", assert(DTY(dtype) == TY_VECT, "vect_llvm_intrinsic_name(): not vect dtype",
DTY(dtype), 4); DTY(dtype), 4);
Expand Down
4 changes: 2 additions & 2 deletions tools/flang2/flang2exe/expand.c
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 1993-2017, NVIDIA CORPORATION. All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1690,7 +1690,7 @@ exp_store(ILM_OP opc, ILM *ilmp, int curilm)
#endif /* LONG_DOUBLE_FLOAT128 */ #endif /* LONG_DOUBLE_FLOAT128 */


case ILIA_LNK: case ILIA_LNK:
dt = ili_get_vect_type(expr); dt = ili_get_vect_dtype(expr);
if (dt) { if (dt) {
store = ad2ili(IL_FREE, expr, dt); store = ad2ili(IL_FREE, expr, dt);
break; break;
Expand Down
2 changes: 1 addition & 1 deletion tools/flang2/flang2exe/ili.h
Expand Up @@ -505,7 +505,7 @@ int is_integer_comparison_opcode(ILI_OP); /* includes conditional jumps */
int is_floating_comparison_opcode(ILI_OP); /* ditto */ int is_floating_comparison_opcode(ILI_OP); /* ditto */
int is_unsigned_opcode(ILI_OP); /* ditto */ int is_unsigned_opcode(ILI_OP); /* ditto */


DTYPE ili_get_vect_type(int); DTYPE ili_get_vect_dtype(int);


int ili_subscript(int); int ili_subscript(int);
int ili_isdeleted(int); int ili_isdeleted(int);
Expand Down
16 changes: 8 additions & 8 deletions tools/flang2/flang2exe/iliutil.c
Expand Up @@ -1352,7 +1352,7 @@ ad_cse(int ilix)
break; break;
#endif #endif
case ILIA_LNK: case ILIA_LNK:
if (ili_get_vect_type(ilix)) { if (ili_get_vect_dtype(ilix)) {
ilix = ad1ili(IL_CSE, ilix); ilix = ad1ili(IL_CSE, ilix);
break; break;
} }
Expand Down Expand Up @@ -6740,7 +6740,7 @@ addarth(ILI *ilip)
} }
} }
break; break;
/***** { do not forget to update ili_get_vect_type() { *****/ /***** { do not forget to update ili_get_vect_dtype() { *****/
case IL_VNOT: case IL_VNOT:
case IL_VAND: case IL_VAND:
case IL_VOR: case IL_VOR:
Expand Down Expand Up @@ -6883,10 +6883,10 @@ addarth(ILI *ilip)
} }
assert(IL_VECT(ILI_OPC(op1)),"addarth():expected vector opc", assert(IL_VECT(ILI_OPC(op1)),"addarth():expected vector opc",
ILI_OPC(op1), 4); ILI_OPC(op1), 4);
vdt1 = ili_get_vect_type(op1); vdt1 = ili_get_vect_dtype(op1);
if (IL_VECT(ILI_OPC(op2))) if (IL_VECT(ILI_OPC(op2)))
{ {
vdt2 = ili_get_vect_type(op2); vdt2 = ili_get_vect_dtype(op2);
} }
else if(IL_TYPE(ILI_OPC(op2)) == ILTY_LOAD) else if(IL_TYPE(ILI_OPC(op2)) == ILTY_LOAD)
{ {
Expand Down Expand Up @@ -6947,7 +6947,7 @@ addarth(ILI *ilip)
3, op1, op2, mask_ili); 3, op1, op2, mask_ili);
} }
return ad4altili(opc, op1, op2, mask_ili, ilip->opnd[3], ilix); return ad4altili(opc, op1, op2, mask_ili, ilip->opnd[3], ilix);
/***** } do not forget to update ili_get_vect_type() } *****/ /***** } do not forget to update ili_get_vect_dtype() } *****/
break; break;


#ifdef LONG_DOUBLE_FLOAT128 #ifdef LONG_DOUBLE_FLOAT128
Expand Down Expand Up @@ -11906,10 +11906,10 @@ qjsrsearch(int ilix)
/** \brief If a VECT ili, return its dtype, 0 otherwise. /** \brief If a VECT ili, return its dtype, 0 otherwise.
*/ */
DTYPE DTYPE
ili_get_vect_type(int ilix) ili_get_vect_dtype(int ilix)
{ {
if (ILI_OPC(ilix) == IL_CSE) if (ILI_OPC(ilix) == IL_CSE)
return ili_get_vect_type(ILI_OPND(ilix, 1)); return ili_get_vect_dtype(ILI_OPND(ilix, 1));
if (!IL_VECT(ILI_OPC(ilix))) if (!IL_VECT(ILI_OPC(ilix)))
return 0; return 0;
switch (ILI_OPC(ilix)) { switch (ILI_OPC(ilix)) {
Expand Down Expand Up @@ -11979,7 +11979,7 @@ ili_get_vect_type(int ilix)
case IL_VBLEND: case IL_VBLEND:
return ILI_OPND(ilix, 4); return ILI_OPND(ilix, 4);
default: default:
interr("ili_get_vect_type missing case for ili opc", ILI_OPC(ilix), 3); interr("ili_get_vect_dtype missing case for ili opc", ILI_OPC(ilix), 3);
} }
return 0; return 0;
} }
Expand Down
6 changes: 3 additions & 3 deletions tools/flang2/flang2exe/regutil.c
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 1993-2017, NVIDIA CORPORATION. All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1188,7 +1188,7 @@ _assn_rtemp(int ili, int temp)
#endif #endif
case ILIA_LNK: case ILIA_LNK:
if (IL_VECT(ILI_OPC(ili))) { if (IL_VECT(ILI_OPC(ili))) {
RCAND_MSIZE(rcand) = ili_get_vect_type(ili); RCAND_MSIZE(rcand) = ili_get_vect_dtype(ili);
rtype = RCAND_RTYPE(rcand) = RATA_VECT; rtype = RCAND_RTYPE(rcand) = RATA_VECT;
break; break;
} }
Expand Down Expand Up @@ -1288,7 +1288,7 @@ select_rtemp(int ili)
break; break;
case ILIA_LNK: case ILIA_LNK:
if (IL_VECT(ILI_OPC(ili))) { if (IL_VECT(ILI_OPC(ili))) {
DTYPE dt = ili_get_vect_type(ili); DTYPE dt = ili_get_vect_dtype(ili);
if (dt) { if (dt) {
type = 8; type = 8;
rtemps[type].dt = dt; rtemps[type].dt = dt;
Expand Down

0 comments on commit 24e0ec3

Please sign in to comment.