[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMITTED] pkl: remove unneeded locs in the passes/phases
From: |
Jose E. Marchesi |
Subject: |
[COMMITTED] pkl: remove unneeded locs in the passes/phases |
Date: |
Thu, 23 Dec 2021 12:17:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
In the past we used to force having location information for all nodes
in the AST. This would assure that a location was always available
when printing error messages involving these nodes. However, this
leads on a miriad of locations that are simply not useful, so we
removed the check.
This patch cleanups to hopefully have the minimum set of locations
that are actually needed.
2021-12-23 Jose E. Marchesi <jemarch@gnu.org>
* libpoke/pkl-ast.c (pkl_ast_sizeof_type): Do not add location
info to internally generated AST nodes.
* libpoke/pkl-fold.c (OP_UNARY_OO): Likewise.
(OP_BINARY_OOO): Likewise.
(OP_BINARY_OIO): Likewise.
(pkl_fold_ps_cast): Likewise.
(pkl_fold_ps_indexer): Likewise.
* libpoke/pkl-promo.c (pkl_promo_ps_type_array): Likewise.
(pkl_promo_ps_array_initializer): Likewise.
(pkl_promo_ps_map): Likewise.
* libpoke/pkl-trans.c (pkl_trans1_ps_offset): Likewise
(pkl_trans1_ps_trimmer): Likewise.
(pkl_trans1_ps_format): Likewise.
(pkl_trans1_ps_array): Likewise.
(pkl_trans2_ps_type_offset): Likewise.
(pkl_trans3_ps_op_sizeof): Likewise.
* libpoke/pkl-typify.c (pkl_typify1_ps_op_not): Likewise.
(pkl_typify1_ps_op_boolean): Likewise.
(pkl_typify1_ps_isa): Likewise.
(TYPIFY_BIN): Likewise.
(CASE_OFFSET): Likewise.
(CASE_OFFSET): Likewise.
(pkl_typify1_ps_bshift_pow): Likewise.
(pkl_typify1_ps_mul): Likewise.
(pkl_typify1_ps_op_in): Likewise.
(pkl_typify1_ps_op_bconc): Likewise.
(pkl_typify1_ps_op_sizeof): Likewise.
(pkl_typify1_ps_offset): Likewise.
(pkl_typify1_ps_array): Likewise.
(pkl_typify1_ps_trimmer): Likewise.
(pkl_typify1_ps_indexer): Likewise.
(pkl_typify1_ps_struct): Likewise.
(pkl_typify1_pr_func): Likewise.
(pkl_typify1_ps_loop_stmt_iterator): Likewise.
(pkl_typify1_ps_attr): Likewise.
* etc/poke.rec (remove unneeded locs in the passes/phases):
Removed as done.
---
ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++++++++
etc/poke.rec | 18 ------------------
libpoke/pkl-ast.c | 5 -----
libpoke/pkl-fold.c | 7 -------
libpoke/pkl-promo.c | 3 ---
libpoke/pkl-trans.c | 25 -------------------------
libpoke/pkl-typify.c | 48 +++---------------------------------------------
7 files changed, 49 insertions(+), 103 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1aa44925..4b59d1a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,51 @@
2021-12-23 Jose E. Marchesi <jemarch@gnu.org>
+ * libpoke/pkl-ast.c (pkl_ast_sizeof_type): Do not add location
+ info to internally generated AST nodes.
+ * libpoke/pkl-fold.c (OP_UNARY_OO): Likewise.
+ (OP_BINARY_OOO): Likewise.
+ (OP_BINARY_OIO): Likewise.
+ (pkl_fold_ps_cast): Likewise.
+ (pkl_fold_ps_indexer): Likewise.
+ * libpoke/pkl-promo.c (pkl_promo_ps_type_array): Likewise.
+ (pkl_promo_ps_array_initializer): Likewise.
+ (pkl_promo_ps_map): Likewise.
+ * libpoke/pkl-trans.c (pkl_trans1_ps_offset): Likewise
+ (pkl_trans1_ps_trimmer): Likewise.
+ (pkl_trans1_ps_format): Likewise.
+ (pkl_trans1_ps_array): Likewise.
+ (pkl_trans2_ps_type_offset): Likewise.
+ (pkl_trans3_ps_op_sizeof): Likewise.
+ * libpoke/pkl-typify.c (pkl_typify1_ps_op_not): Likewise.
+ (pkl_typify1_ps_op_boolean): Likewise.
+ (pkl_typify1_ps_isa): Likewise.
+ (TYPIFY_BIN): Likewise.
+ (CASE_OFFSET): Likewise.
+ (CASE_OFFSET): Likewise.
+ (pkl_typify1_ps_bshift_pow): Likewise.
+ (pkl_typify1_ps_mul): Likewise.
+ (pkl_typify1_ps_op_in): Likewise.
+ (pkl_typify1_ps_op_bconc): Likewise.
+ (pkl_typify1_ps_op_sizeof): Likewise.
+ (pkl_typify1_ps_offset): Likewise.
+ (pkl_typify1_ps_array): Likewise.
+ (pkl_typify1_ps_trimmer): Likewise.
+ (pkl_typify1_ps_indexer): Likewise.
+ (pkl_typify1_ps_struct): Likewise.
+ (pkl_typify1_pr_func): Likewise.
+ (pkl_typify1_ps_loop_stmt_iterator): Likewise.
+ (pkl_typify1_ps_attr): Likewise.
+
+ * etc/poke.rec (remove unneeded locs in the passes/phases):
+ Removed as done.
+
+2021-12-23 Jose E. Marchesi <jemarch@gnu.org>
+
+ * etc/poke.rec (Pass the declaration's pk_value in callback
+ pk_map_decl_fn): Removed as done.
+
+2021-12-23 Jose E. Marchesi <jemarch@gnu.org>
+
* etc/poke.rec (.set with no arguments should give a summary of
all options): Removed as done.
diff --git a/etc/poke.rec b/etc/poke.rec
index 47a38467..e3200326 100644
--- a/etc/poke.rec
+++ b/etc/poke.rec
@@ -814,24 +814,6 @@ Description:
+ This task is about identifying these cases, and to move the
+ corresponding check to anal1.
-Summary: remove unneeded locs in the passes/phases
-Component: Compiler
-Kind: ENH
-Priority: 3
-Description:
-+ In the past we used to force having location information for all nodes
-+ in the AST. This would assure that a location was always available
-+ when printing error messages involving these nodes. However, this
-+ leads on a miriad of locations that are simply not useful, so we
-+ removed the check.
-+
-+ This task is about:
-+ 1) Identifying which LOCs are not needed, and remove them, and
-+ 2) Emit an ICE if no location is found at error/warning emission time.
-+
-+ This will hopefully lead to have the minimum set of locations that is
-+ actually needed.
-
Summary: unify `break' and `continue' in the same AST node
Component: Compiler
Kind: ENH
diff --git a/libpoke/pkl-ast.c b/libpoke/pkl-ast.c
index 69f5a053..d0573a87 100644
--- a/libpoke/pkl-ast.c
+++ b/libpoke/pkl-ast.c
@@ -956,7 +956,6 @@ pkl_ast_sizeof_type (pkl_ast ast, pkl_ast_node type)
pkl_ast_node res;
pkl_ast_node res_type
= pkl_ast_make_integral_type (ast, 64, 0);
- PKL_AST_LOC (res_type) = PKL_AST_LOC (type);
/* This function should only be called on complete types. */
assert (PKL_AST_TYPE_COMPLETE (type)
@@ -967,7 +966,6 @@ pkl_ast_sizeof_type (pkl_ast ast, pkl_ast_node type)
case PKL_TYPE_INTEGRAL:
{
res = pkl_ast_make_integer (ast, PKL_AST_TYPE_I_SIZE (type));
- PKL_AST_LOC (res) = PKL_AST_LOC (type);
PKL_AST_TYPE (res) = ASTREF (res_type);
break;
}
@@ -979,7 +977,6 @@ pkl_ast_sizeof_type (pkl_ast ast, pkl_ast_node type)
res= pkl_ast_make_binary_exp (ast, PKL_AST_OP_MUL,
PKL_AST_TYPE_A_BOUND (type),
sizeof_etype);
- PKL_AST_LOC (res) = PKL_AST_LOC (type);
PKL_AST_TYPE (res) = ASTREF (res_type);
break;
}
@@ -989,7 +986,6 @@ pkl_ast_sizeof_type (pkl_ast ast, pkl_ast_node type)
res = pkl_ast_make_integer (ast, 0);
PKL_AST_TYPE (res) = ASTREF (res_type);
- PKL_AST_LOC (res) = PKL_AST_LOC (type);
for (t = PKL_AST_TYPE_S_ELEMS (type); t; t = PKL_AST_CHAIN (t))
{
@@ -1049,7 +1045,6 @@ pkl_ast_sizeof_type (pkl_ast ast, pkl_ast_node type)
/* By convention functions have sizeof 0#b */
res = pkl_ast_make_integer (ast, 0);
PKL_AST_TYPE (res) = ASTREF (res_type);
- PKL_AST_LOC (res) = PKL_AST_LOC (type);
break;
}
case PKL_TYPE_OFFSET:
diff --git a/libpoke/pkl-fold.c b/libpoke/pkl-fold.c
index 4d4bc55b..8a5a7b5a 100644
--- a/libpoke/pkl-fold.c
+++ b/libpoke/pkl-fold.c
@@ -297,7 +297,6 @@ EMUL_UU (bnoto) { return ~op; }
\
magnitude = pkl_ast_make_integer (PKL_PASS_AST, result); \
PKL_AST_TYPE (magnitude) = ASTREF (type_base_type); \
- PKL_AST_LOC (magnitude) = PKL_AST_LOC (PKL_PASS_NODE); \
\
new = pkl_ast_make_offset (PKL_PASS_AST, magnitude, \
type_unit); \
@@ -430,7 +429,6 @@ EMUL_UU (bnoto) { return ~op; }
\
magnitude = pkl_ast_make_integer (PKL_PASS_AST, result); \
PKL_AST_TYPE (magnitude) = ASTREF (type_base_type); \
- PKL_AST_LOC (magnitude) = PKL_AST_LOC (PKL_PASS_NODE); \
\
new = pkl_ast_make_offset (PKL_PASS_AST, magnitude, \
type_unit); \
@@ -542,7 +540,6 @@ EMUL_UU (bnoto) { return ~op; }
\
magnitude = pkl_ast_make_integer (PKL_PASS_AST, result); \
PKL_AST_TYPE (magnitude) = ASTREF (type_base_type); \
- PKL_AST_LOC (magnitude) = PKL_AST_LOC (PKL_PASS_NODE); \
\
new = pkl_ast_make_offset (PKL_PASS_AST, magnitude, \
type_unit); \
@@ -826,7 +823,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_fold_pow)
magnitude = pkl_ast_make_integer (PKL_PASS_AST, result);
PKL_AST_TYPE (magnitude) = ASTREF (type_base_type);
- PKL_AST_LOC (magnitude) = PKL_AST_LOC (PKL_PASS_NODE);
new = pkl_ast_make_offset (PKL_PASS_AST, magnitude,
type_unit);
@@ -1073,7 +1069,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_fold_ps_cast)
PKL_AST_INTEGER_VALUE (to_unit));
PKL_AST_TYPE (new_unit) = ASTREF (unit_type);
- PKL_AST_LOC (new_unit) = PKL_AST_LOC (unit);
unit = new_unit;
}
@@ -1084,7 +1079,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_fold_ps_cast)
magnitude = pkl_ast_make_integer (PKL_PASS_AST,
PKL_AST_INTEGER_VALUE (magnitude));
PKL_AST_TYPE (magnitude) = ASTREF (to_base_type);
- PKL_AST_LOC (magnitude) = PKL_AST_LOC (cast);
}
/* Transform magnitude to new unit. */
@@ -1171,7 +1165,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_fold_ps_indexer)
new_type = pkl_ast_make_integral_type (PKL_PASS_AST, 8, 0);
new = pkl_ast_make_integer (PKL_PASS_AST, str[index_value]);
- PKL_AST_LOC (new_type) = PKL_AST_LOC (index);
PKL_AST_LOC (new) = PKL_AST_LOC (index);
PKL_AST_TYPE (new) = ASTREF (new_type);
diff --git a/libpoke/pkl-promo.c b/libpoke/pkl-promo.c
index a875524f..e71a63d3 100644
--- a/libpoke/pkl-promo.c
+++ b/libpoke/pkl-promo.c
@@ -941,7 +941,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_type_array)
pkl_ast_node unit_bit = pkl_ast_make_integer (PKL_PASS_AST, 1);
unit_bit = ASTREF (unit_bit);
- PKL_AST_LOC (unit_bit) = PKL_AST_LOC (PKL_PASS_NODE);
if (!promote_offset (PKL_PASS_AST,
64, 0, unit_bit,
@@ -988,7 +987,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_array_initializer)
index_type = pkl_ast_make_integral_type (PKL_PASS_AST,
64, 0);
PKL_AST_TYPE (index) = ASTREF (index_type);
- PKL_AST_LOC (index_type) = PKL_AST_LOC (node);
PKL_PASS_RESTART = 1;
}
}
@@ -1275,7 +1273,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_map)
pkl_ast_node unit_bit = pkl_ast_make_integer (PKL_PASS_AST, 1);
unit_bit = ASTREF (unit_bit);
- PKL_AST_LOC (unit_bit) = PKL_AST_LOC (PKL_PASS_NODE);
if (!promote_offset (PKL_PASS_AST,
64, 0, unit_bit,
diff --git a/libpoke/pkl-trans.c b/libpoke/pkl-trans.c
index 27d8fa73..912de165 100644
--- a/libpoke/pkl-trans.c
+++ b/libpoke/pkl-trans.c
@@ -224,10 +224,7 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_offset)
pkl_ast_node magnitude
= pkl_ast_make_integer (PKL_PASS_AST, 1);
- PKL_AST_LOC (magnitude_type) = PKL_AST_LOC (offset);
- PKL_AST_LOC (magnitude) = PKL_AST_LOC (offset);
PKL_AST_TYPE (magnitude) = ASTREF (magnitude_type);
-
PKL_AST_OFFSET_MAGNITUDE (offset) = ASTREF (magnitude);
}
}
@@ -609,9 +606,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_trimmer)
from = pkl_ast_make_integer (PKL_PASS_AST, 0);
PKL_AST_TYPE (from) = ASTREF (idx_type);
- PKL_AST_LOC (idx_type) = PKL_AST_LOC (trimmer);
- PKL_AST_LOC (from) = PKL_AST_LOC (trimmer);
-
PKL_AST_TRIMMER_FROM (trimmer) = ASTREF (from);
}
@@ -758,7 +752,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_format)
msg = _("invalid flag");
goto invalid_tag;
}
- PKL_AST_LOC (atype) = PKL_AST_LOC (format_fmt);
types = pkl_ast_chainon (types, atype);
ntag++;
break;
@@ -766,7 +759,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_format)
p += 2;
PKL_AST_FORMAT_ARG_BASE (arg) = 10; /* Arbitrary. */
atype = pkl_ast_make_string_type (PKL_PASS_AST);
- PKL_AST_LOC (atype) = PKL_AST_LOC (format_fmt);
types = pkl_ast_chainon (types, atype);
ntag++;
break;
@@ -774,7 +766,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_format)
p += 2;
PKL_AST_FORMAT_ARG_BASE (arg) = 256; /* Arbitrary */
atype = pkl_ast_make_integral_type (PKL_PASS_AST, 8, 0);
- PKL_AST_LOC (atype) = PKL_AST_LOC (format_fmt);
types = pkl_ast_chainon (types, atype);
ntag++;
break;
@@ -830,7 +821,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_format)
}
atype = pkl_ast_make_integral_type (PKL_PASS_AST,
bits, p[1] == 'i');
- PKL_AST_LOC (atype) = PKL_AST_LOC (format_fmt);
types = pkl_ast_chainon (types, atype);
if (base_idx == 4)
@@ -920,7 +910,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_format)
/* Create the new arg and add it to the list of arguments. */
new_arg = pkl_ast_make_format_arg (PKL_PASS_AST, NULL);
- PKL_AST_LOC (new_arg) = PKL_AST_LOC (format_fmt);
if (add_new_percent_arg_p)
PKL_AST_FORMAT_ARG_SUFFIX (new_arg) = xstrdup ("%");
@@ -965,7 +954,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_format)
/* The type corresponding to new arg is `void'. */
atype = pkl_ast_make_void_type (PKL_PASS_AST);
- PKL_AST_LOC (atype) = PKL_AST_LOC (format_fmt);
types = pkl_ast_chainon (types, atype);
add_new_percent_arg_p = 0;
@@ -1037,16 +1025,11 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans1_ps_array)
{
pkl_ast_node initializer_index_type
= pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0);
- PKL_AST_LOC (initializer_index_type)
- = PKL_AST_LOC (tmp);
-
initializer_index_node
= pkl_ast_make_integer (PKL_PASS_AST, index);
PKL_AST_TYPE (initializer_index_node)
= ASTREF (initializer_index_type);
- PKL_AST_LOC (initializer_index_node)
- = PKL_AST_LOC (tmp);
PKL_AST_ARRAY_INITIALIZER_INDEX (tmp)
= ASTREF (initializer_index_node);
@@ -1377,8 +1360,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans2_ps_type_offset)
/* Calculate the size of the complete type in bytes and put it in
an integer node. */
unit = pkl_ast_sizeof_type (PKL_PASS_AST, unit_type);
- PKL_AST_LOC (unit) = PKL_AST_LOC (unit_type);
- PKL_AST_LOC (PKL_AST_TYPE (unit)) = PKL_AST_LOC (unit_type);
/* Replace the unit type with this expression. */
PKL_AST_TYPE_O_UNIT (type) = ASTREF (unit);
@@ -1466,24 +1447,18 @@ PKL_PHASE_BEGIN_HANDLER (pkl_trans3_ps_op_sizeof)
an integer node. */
pkl_ast_node magnitude
= pkl_ast_sizeof_type (PKL_PASS_AST, op);
- PKL_AST_LOC (magnitude) = PKL_AST_LOC (node);
- PKL_AST_LOC (PKL_AST_TYPE (magnitude)) = PKL_AST_LOC (node);
/* Build an offset with that magnitude, and unit bits. */
unit_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0);
- PKL_AST_LOC (unit_type) = PKL_AST_LOC (node);
unit = pkl_ast_make_integer (PKL_PASS_AST, PKL_AST_OFFSET_UNIT_BITS);
- PKL_AST_LOC (unit) = PKL_AST_LOC (node);
PKL_AST_TYPE (unit) = ASTREF (unit_type);
offset = pkl_ast_make_offset (PKL_PASS_AST, magnitude, unit);
- PKL_AST_LOC (offset) = PKL_AST_LOC (node);
offset_type = pkl_ast_make_offset_type (PKL_PASS_AST,
PKL_AST_TYPE (magnitude),
unit);
- PKL_AST_LOC (offset_type) = PKL_AST_LOC (node);
PKL_AST_TYPE (offset) = ASTREF (offset_type);
}
diff --git a/libpoke/pkl-typify.c b/libpoke/pkl-typify.c
index fc9d10c4..76c43a3d 100644
--- a/libpoke/pkl-typify.c
+++ b/libpoke/pkl-typify.c
@@ -105,7 +105,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_not)
pkl_ast_node exp_type
= pkl_ast_make_integral_type (PKL_PASS_AST, 32, 1);
- PKL_AST_LOC (exp_type) = PKL_AST_LOC (PKL_PASS_NODE);
PKL_AST_TYPE (PKL_PASS_NODE) = ASTREF (exp_type);
}
}
@@ -208,7 +207,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_rela)
/* Set the type of the expression node. */
exp_type = pkl_ast_make_integral_type (PKL_PASS_AST, 32, 1);
- PKL_AST_LOC (exp_type) = PKL_AST_LOC (PKL_PASS_NODE);
PKL_AST_TYPE (PKL_PASS_NODE) = ASTREF (exp_type);
PKL_PASS_DONE;
@@ -272,7 +270,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_boolean)
}
type = pkl_ast_make_integral_type (PKL_PASS_AST, 32, 1);
- PKL_AST_LOC (type) = PKL_AST_LOC (PKL_PASS_NODE);
PKL_AST_TYPE (PKL_PASS_NODE) = ASTREF (type);
}
PKL_PHASE_END_HANDLER
@@ -343,7 +340,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_isa)
pkl_ast_node bool_type
= pkl_ast_make_integral_type (PKL_PASS_AST, 32, 1);
- PKL_AST_LOC (bool_type) = PKL_AST_LOC (isa);
if (PKL_AST_TYPE_CODE (isa_type) == PKL_TYPE_ANY)
{
@@ -352,7 +348,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_isa)
pkl_ast_node true_node = pkl_ast_make_integer (PKL_PASS_AST, 1);
PKL_AST_TYPE (true_node) = ASTREF (bool_type);
- PKL_AST_LOC (true_node) = PKL_AST_LOC (isa);
pkl_ast_node_free (PKL_PASS_NODE);
PKL_PASS_NODE = true_node;
@@ -365,7 +360,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_isa)
PKL_AST_TYPE (bool_node) = ASTREF (bool_type);
- PKL_AST_LOC (bool_node) = PKL_AST_LOC (isa);
pkl_ast_node_free (PKL_PASS_NODE);
PKL_PASS_NODE = bool_node;
@@ -624,7 +618,6 @@ PKL_PHASE_END_HANDLER
break; \
} \
\
- PKL_AST_LOC (type) = PKL_AST_LOC (exp); \
PKL_AST_TYPE (exp) = ASTREF (type); \
PKL_PASS_DONE; \
\
@@ -711,8 +704,6 @@ PKL_PHASE_END_HANDLER
PKL_AST_OP_GCD, \
unit_type_1, unit_type_2); \
\
- PKL_AST_LOC (unit) = PKL_AST_LOC (exp); \
- PKL_AST_LOC (unit_type) = PKL_AST_LOC (exp); \
PKL_AST_TYPE (unit) = ASTREF (unit_type); \
\
type = pkl_ast_make_offset_type (PKL_PASS_AST, \
@@ -749,11 +740,9 @@ TYPIFY_BIN (mod);
\
pkl_ast_node base_type \
= pkl_ast_make_integral_type (PKL_PASS_AST, size, signed_p); \
- PKL_AST_LOC (base_type) = PKL_AST_LOC (exp); \
\
/* The unit of the result is the GCD of the units involved. */ \
unit_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0); \
- PKL_AST_LOC (unit_type) = PKL_AST_LOC (exp); \
\
if (PKL_AST_CODE (unit_type_1) == PKL_AST_INTEGER \
&& PKL_AST_CODE (unit_type_2) == PKL_AST_INTEGER) \
@@ -769,7 +758,6 @@ TYPIFY_BIN (mod);
PKL_AST_OP_GCD, \
unit_type_1, unit_type_2); \
\
- PKL_AST_LOC (unit) = PKL_AST_LOC (exp); \
PKL_AST_TYPE (unit) = ASTREF (unit_type); \
\
type = pkl_ast_make_offset_type (PKL_PASS_AST, \
@@ -887,7 +875,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_bshift_pow)
break;
}
- PKL_AST_LOC (type) = PKL_AST_LOC (exp);
PKL_AST_TYPE (exp) = ASTREF (type);
PKL_PASS_DONE;
}
@@ -959,7 +946,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_mul)
pkl_ast_node res_base_type
= pkl_ast_make_integral_type (PKL_PASS_AST, size, signed_p);
- PKL_AST_LOC (res_base_type) = PKL_AST_LOC (exp);
/* The unit of the result is the unit of the offset operand */
type = pkl_ast_make_offset_type (PKL_PASS_AST,
@@ -980,7 +966,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_mul)
}
}
- PKL_AST_LOC (type) = PKL_AST_LOC (exp);
PKL_AST_TYPE (exp) = ASTREF (type);
PKL_PASS_DONE;
@@ -1039,7 +1024,6 @@ expected %s, got %s",
}
exp_type = pkl_ast_make_integral_type (PKL_PASS_AST, 32, 1);
- PKL_AST_LOC (exp_type) = PKL_AST_LOC (exp);
PKL_AST_TYPE (exp) = ASTREF (exp_type);
}
PKL_PHASE_END_HANDLER
@@ -1104,8 +1088,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_bconc)
PKL_AST_TYPE_I_SIZE (t1)
+ PKL_AST_TYPE_I_SIZE (t2),
PKL_AST_TYPE_I_SIGNED_P (t1));
- PKL_AST_LOC (exp_type) = PKL_AST_LOC (exp);
-
PKL_AST_TYPE (exp) = ASTREF (exp_type);
}
PKL_PHASE_END_HANDLER
@@ -1125,9 +1107,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_sizeof)
= pkl_ast_make_offset_type (PKL_PASS_AST, itype, unit);
PKL_AST_TYPE (unit) = ASTREF (itype);
- PKL_AST_LOC (unit) = PKL_AST_LOC (PKL_PASS_NODE);
- PKL_AST_LOC (itype) = PKL_AST_LOC (PKL_PASS_NODE);
- PKL_AST_LOC (type) = PKL_AST_LOC (PKL_PASS_NODE);
PKL_AST_TYPE (PKL_PASS_NODE) = ASTREF (type);
}
PKL_PHASE_END_HANDLER
@@ -1160,9 +1139,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_offset)
/* Calculate the size of the complete type in bits and put it in
an integer node. */
new_unit = pkl_ast_sizeof_type (PKL_PASS_AST, unit);
- PKL_AST_LOC (new_unit) = PKL_AST_LOC (unit);
- PKL_AST_LOC (PKL_AST_TYPE (new_unit)) = PKL_AST_LOC (unit);
-
pkl_ast_node_free (unit);
unit = new_unit;
PKL_AST_OFFSET_UNIT (offset) = ASTREF (unit);
@@ -1170,7 +1146,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_offset)
type = pkl_ast_make_offset_type (PKL_PASS_AST,
magnitude_type, unit);
- PKL_AST_LOC (type) = PKL_AST_LOC (offset);
PKL_AST_TYPE (offset) = ASTREF (type);
}
PKL_PHASE_END_HANDLER
@@ -1213,11 +1188,8 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_array)
pkl_ast_node array_type;
PKL_AST_TYPE (bound) = ASTREF (bound_type);
- PKL_AST_LOC (bound) = PKL_AST_LOC (PKL_PASS_NODE);
- PKL_AST_LOC (bound_type) = PKL_AST_LOC (PKL_PASS_NODE);
array_type = pkl_ast_make_array_type (PKL_PASS_AST, type, bound);
- PKL_AST_LOC (array_type) = PKL_AST_LOC (PKL_PASS_NODE);
PKL_AST_TYPE_COMPLETE (array_type) = PKL_AST_TYPE_COMPLETE (type);
PKL_AST_TYPE (array) = ASTREF (array_type);
}
@@ -1271,8 +1243,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_trimmer)
new_type = pkl_ast_make_array_type (PKL_PASS_AST,
PKL_AST_TYPE_A_ETYPE (entity_type),
NULL /* bound */);
- PKL_AST_LOC (new_type) = PKL_AST_LOC (entity_type);
-
PKL_AST_TYPE (trimmer) = ASTREF (new_type);
}
else
@@ -1306,7 +1276,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_indexer)
{
/* The type of the indexer is a `char', i.e. a uint<8>. */
type = pkl_ast_make_integral_type (PKL_PASS_AST, 8, 0);
- PKL_AST_LOC (type) = PKL_AST_LOC (indexer);
break;
}
default:
@@ -1350,11 +1319,9 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_struct)
NULL /* label */,
PKL_AST_ENDIAN_DFL /* endian */,
NULL /* optcond */);
- PKL_AST_LOC (struct_type_field) = PKL_AST_LOC (t);
struct_field_types = pkl_ast_chainon (struct_field_types,
struct_type_field);
-
if (!PKL_AST_TYPE_COMPLETE (PKL_AST_TYPE (t)))
type_complete = 0;
}
@@ -1368,7 +1335,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_struct)
struct_field_types,
0 /* pinned */,
0 /* union */);
- PKL_AST_LOC (type) = PKL_AST_LOC (node);
PKL_AST_TYPE (node) = ASTREF (type);
PKL_AST_TYPE_COMPLETE (type) = type_complete;
}
@@ -1393,7 +1359,9 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_pr_func)
= pkl_ast_make_func_type_arg (PKL_PASS_AST,
PKL_AST_FUNC_ARG_TYPE (t),
PKL_AST_FUNC_ARG_IDENTIFIER (t));
- PKL_AST_LOC (func_type_arg) = PKL_AST_LOC (t);
+ PKL_AST_LOC (func_type_arg) = PKL_AST_LOC (t); /* XXX this
+ shouldn't be
+ necessary. */
func_type_args = pkl_ast_chainon (func_type_args,
func_type_arg);
@@ -1410,7 +1378,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_pr_func)
PKL_AST_FUNC_RET_TYPE (node),
nargs,
func_type_args);
- PKL_AST_LOC (type) = PKL_AST_LOC (node);
PKL_AST_TYPE (node) = ASTREF (type);
}
PKL_PHASE_END_HANDLER
@@ -2243,7 +2210,6 @@ PKL_PHASE_BEGIN_HANDLER
(pkl_typify1_ps_loop_stmt_iterator)
/* Container is a string. */
container_elem_type
= pkl_ast_make_integral_type (PKL_PASS_AST, 8, 0);
- PKL_AST_LOC (container_elem_type) = PKL_AST_LOC (container_type);
}
PKL_AST_TYPE (PKL_AST_DECL_INITIAL (decl))
@@ -2438,13 +2404,10 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_attr)
/* 'size is defined for all kind of values. */
/* The type of 'size is offset<uint<64>,1> */
offset_unit_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0);
- PKL_AST_LOC (offset_unit_type) = PKL_AST_LOC (exp);
offset_unit = pkl_ast_make_integer (PKL_PASS_AST, 1);
- PKL_AST_LOC (offset_unit) = PKL_AST_LOC (exp);
PKL_AST_TYPE (offset_unit) = ASTREF (offset_unit_type);
exp_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0);
- PKL_AST_LOC (exp_type) = PKL_AST_LOC (exp);
exp_type = pkl_ast_make_offset_type (PKL_PASS_AST, exp_type,
offset_unit);
PKL_AST_TYPE (exp) = ASTREF (exp_type);
@@ -2506,13 +2469,10 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_attr)
case PKL_AST_ATTR_OFFSET:
/* The type of 'offset is an offset<uint<64>,1> */
offset_unit_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0);
- PKL_AST_LOC (offset_unit_type) = PKL_AST_LOC (exp);
offset_unit = pkl_ast_make_integer (PKL_PASS_AST, 1);
- PKL_AST_LOC (offset_unit) = PKL_AST_LOC (exp);
PKL_AST_TYPE (offset_unit) = ASTREF (offset_unit_type);
exp_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64, 0);
- PKL_AST_LOC (exp_type) = PKL_AST_LOC (exp);
exp_type = pkl_ast_make_offset_type (PKL_PASS_AST, exp_type,
offset_unit);
PKL_AST_TYPE (exp) = ASTREF (exp_type);
@@ -2536,8 +2496,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_attr)
break;
}
- PKL_AST_LOC (exp_type) = PKL_AST_LOC (exp);
-
PKL_PASS_DONE;
invalid_attribute:
--
2.11.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [COMMITTED] pkl: remove unneeded locs in the passes/phases,
Jose E. Marchesi <=