* [Patch, fortran] PR 32909 Replace gfc_c_int_type_node with integer_type_node
@ 2007-07-27 19:56 Janne Blomqvist
2007-07-27 22:04 ` FX Coudert
0 siblings, 1 reply; 2+ messages in thread
From: Janne Blomqvist @ 2007-07-27 19:56 UTC (permalink / raw)
To: gfortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
Hi,
this is yet another obvious patch which I intend to commit in 24h,
barring objections. In many places in the frontend we were creating a
tree gfc_c_int_type_node to represent a C int. This is unnecessary,
since the middle-end already defines such a tree, integer_type_node,
which fwiw was already used in some places in gfortran.
--
Janne Blomqvist
[-- Attachment #2: ChangeLog --]
[-- Type: text/plain, Size: 387 bytes --]
2007-07-27 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/32909
* trans-stmt.c (gfc_trans_character_select): Replace occurrences
of gfc_c_int_type_node with integer_type_node.
* trans-decl.c (gfc_build_intrinsic_function_decls): Likewise.
(gfc_build_builtin_function_decls): Likewise.
(gfc_generate_function_code): Likewise.
* trans-io.c (gfc_build_io_library_fndecls): Likewise.
[-- Attachment #3: gfc_c_int_type_node.diff --]
[-- Type: text/x-patch, Size: 12291 bytes --]
Index: trans-stmt.c
===================================================================
--- trans-stmt.c (revision 126992)
+++ trans-stmt.c (working copy)
@@ -1320,7 +1320,6 @@ static tree
gfc_trans_character_select (gfc_code *code)
{
tree init, node, end_label, tmp, type, case_num, label;
- tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
stmtblock_t block, body;
gfc_case *cp, *d;
gfc_code *c;
@@ -1351,7 +1350,7 @@ gfc_trans_character_select (gfc_code *co
ADD_FIELD (string2, pchar_type_node);
ADD_FIELD (string2_len, gfc_int4_type_node);
- ADD_FIELD (target, gfc_c_int_type_node);
+ ADD_FIELD (target, integer_type_node);
#undef ADD_FIELD
gfc_finish_type (select_struct);
@@ -1425,7 +1424,7 @@ gfc_trans_character_select (gfc_code *co
node = tree_cons (ss_string2_len, se.string_length, node);
}
- node = tree_cons (ss_target, build_int_cst (gfc_c_int_type_node, d->n),
+ node = tree_cons (ss_target, build_int_cst (integer_type_node, d->n),
node);
tmp = build_constructor_from_list (select_struct, nreverse (node));
@@ -1459,7 +1458,7 @@ gfc_trans_character_select (gfc_code *co
tmp = build_call_expr (gfor_fndecl_select_string, 4, init,
build_int_cst (NULL_TREE, n), se.expr,
se.string_length);
- case_num = gfc_create_var (gfc_c_int_type_node, "case_num");
+ case_num = gfc_create_var (integer_type_node, "case_num");
gfc_add_modify_expr (&block, case_num, tmp);
gfc_add_block_to_block (&block, &se.post);
Index: trans-decl.c
===================================================================
--- trans-decl.c (revision 126993)
+++ trans-decl.c (working copy)
@@ -1995,7 +1995,6 @@ gfc_build_intrinsic_function_decls (void
tree gfc_complex8_type_node = gfc_get_complex_type (8);
tree gfc_complex10_type_node = gfc_get_complex_type (10);
tree gfc_complex16_type_node = gfc_get_complex_type (16);
- tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
/* String functions. */
gfor_fndecl_compare_string =
@@ -2055,7 +2054,7 @@ gfc_build_intrinsic_function_decls (void
3,
pchar_type_node,
gfc_charlen_type_node,
- gfc_c_int_type_node);
+ integer_type_node);
gfor_fndecl_fdate =
gfc_build_library_function_decl (get_identifier (PREFIX("fdate")),
@@ -2215,7 +2214,7 @@ gfc_build_intrinsic_function_decls (void
/* BLAS functions. */
{
- tree pint = build_pointer_type (gfc_c_int_type_node);
+ tree pint = build_pointer_type (integer_type_node);
tree ps = build_pointer_type (gfc_get_real_type (gfc_default_real_kind));
tree pd = build_pointer_type (gfc_get_real_type (gfc_default_double_kind));
tree pc = build_pointer_type (gfc_get_complex_type (gfc_default_real_kind));
@@ -2228,32 +2227,32 @@ gfc_build_intrinsic_function_decls (void
: "sgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, ps, ps, pint,
- ps, pint, ps, ps, pint, gfc_c_int_type_node,
- gfc_c_int_type_node);
+ ps, pint, ps, ps, pint, integer_type_node,
+ integer_type_node);
gfor_fndecl_dgemm = gfc_build_library_function_decl
(get_identifier
(gfc_option.flag_underscoring ? "dgemm_"
: "dgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, pd, pd, pint,
- pd, pint, pd, pd, pint, gfc_c_int_type_node,
- gfc_c_int_type_node);
+ pd, pint, pd, pd, pint, integer_type_node,
+ integer_type_node);
gfor_fndecl_cgemm = gfc_build_library_function_decl
(get_identifier
(gfc_option.flag_underscoring ? "cgemm_"
: "cgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, pc, pc, pint,
- pc, pint, pc, pc, pint, gfc_c_int_type_node,
- gfc_c_int_type_node);
+ pc, pint, pc, pc, pint, integer_type_node,
+ integer_type_node);
gfor_fndecl_zgemm = gfc_build_library_function_decl
(get_identifier
(gfc_option.flag_underscoring ? "zgemm_"
: "zgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, pz, pz, pint,
- pz, pint, pz, pz, pint, gfc_c_int_type_node,
- gfc_c_int_type_node);
+ pz, pint, pz, pz, pint, integer_type_node,
+ integer_type_node);
}
/* Other functions. */
@@ -2279,7 +2278,6 @@ gfc_build_intrinsic_function_decls (void
void
gfc_build_builtin_function_decls (void)
{
- tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
tree gfc_int4_type_node = gfc_get_int_type (4);
tree gfc_logical4_type_node = gfc_get_logical_type (4);
tree gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node);
@@ -2332,7 +2330,7 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_select_string =
gfc_build_library_function_decl (get_identifier (PREFIX("select_string")),
- gfc_c_int_type_node, 0);
+ integer_type_node, 0);
gfor_fndecl_runtime_error =
gfc_build_library_function_decl (get_identifier (PREFIX("runtime_error")),
@@ -2350,7 +2348,7 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_generate_error =
gfc_build_library_function_decl (get_identifier (PREFIX("generate_error")),
void_type_node, 3, pvoid_type_node,
- gfc_c_int_type_node, pchar_type_node);
+ integer_type_node, pchar_type_node);
gfor_fndecl_os_error =
gfc_build_library_function_decl (get_identifier (PREFIX("os_error")),
@@ -2360,25 +2358,25 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_set_fpe =
gfc_build_library_function_decl (get_identifier (PREFIX("set_fpe")),
- void_type_node, 1, gfc_c_int_type_node);
+ void_type_node, 1, integer_type_node);
/* Keep the array dimension in sync with the call, later in this file. */
gfor_fndecl_set_options =
gfc_build_library_function_decl (get_identifier (PREFIX("set_options")),
- void_type_node, 2, gfc_c_int_type_node,
+ void_type_node, 2, integer_type_node,
pvoid_type_node);
gfor_fndecl_set_convert =
gfc_build_library_function_decl (get_identifier (PREFIX("set_convert")),
- void_type_node, 1, gfc_c_int_type_node);
+ void_type_node, 1, integer_type_node);
gfor_fndecl_set_record_marker =
gfc_build_library_function_decl (get_identifier (PREFIX("set_record_marker")),
- void_type_node, 1, gfc_c_int_type_node);
+ void_type_node, 1, integer_type_node);
gfor_fndecl_set_max_subrecord_length =
gfc_build_library_function_decl (get_identifier (PREFIX("set_max_subrecord_length")),
- void_type_node, 1, gfc_c_int_type_node);
+ void_type_node, 1, integer_type_node);
gfor_fndecl_in_pack = gfc_build_library_function_decl (
get_identifier (PREFIX("internal_pack")),
@@ -3186,7 +3184,6 @@ gfc_generate_function_code (gfc_namespac
runtime library Fortran language standard parameters. */
if (sym->attr.is_main_program)
{
- tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
tree array_type, array, var;
/* Passing a new option to the library requires four modifications:
@@ -3196,28 +3193,28 @@ gfc_generate_function_code (gfc_namespac
gfor_fndecl_set_options
+ modify the library (runtime/compile_options.c)! */
array = tree_cons (NULL_TREE,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.warn_std), NULL_TREE);
array = tree_cons (NULL_TREE,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.allow_std), array);
array = tree_cons (NULL_TREE,
- build_int_cst (gfc_c_int_type_node, pedantic), array);
+ build_int_cst (integer_type_node, pedantic), array);
array = tree_cons (NULL_TREE,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.flag_dump_core), array);
array = tree_cons (NULL_TREE,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.flag_backtrace), array);
array = tree_cons (NULL_TREE,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.flag_sign_zero), array);
array = tree_cons (NULL_TREE,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
flag_bounds_check), array);
- array_type = build_array_type (gfc_c_int_type_node,
+ array_type = build_array_type (integer_type_node,
build_index_type (build_int_cst (NULL_TREE,
6)));
array = build_constructor_from_list (array_type, nreverse (array));
@@ -3235,7 +3232,7 @@ gfc_generate_function_code (gfc_namespac
var = gfc_build_addr_expr (pvoid_type_node, var);
tmp = build_call_expr (gfor_fndecl_set_options, 2,
- build_int_cst (gfc_c_int_type_node, 7), var);
+ build_int_cst (integer_type_node, 7), var);
gfc_add_expr_to_block (&body, tmp);
}
@@ -3244,9 +3241,8 @@ gfc_generate_function_code (gfc_namespac
needed. */
if (sym->attr.is_main_program && gfc_option.fpe != 0)
{
- tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
tmp = build_call_expr (gfor_fndecl_set_fpe, 1,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.fpe));
gfc_add_expr_to_block (&body, tmp);
}
@@ -3256,9 +3252,8 @@ gfc_generate_function_code (gfc_namespac
if (sym->attr.is_main_program && gfc_option.convert != CONVERT_NATIVE)
{
- tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
tmp = build_call_expr (gfor_fndecl_set_convert, 1,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.convert));
gfc_add_expr_to_block (&body, tmp);
}
@@ -3268,21 +3263,17 @@ gfc_generate_function_code (gfc_namespac
if (sym->attr.is_main_program && gfc_option.record_marker != 0)
{
- tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
tmp = build_call_expr (gfor_fndecl_set_record_marker, 1,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.record_marker));
gfc_add_expr_to_block (&body, tmp);
}
if (sym->attr.is_main_program && gfc_option.max_subrecord_length != 0)
{
- tree gfc_c_int_type_node;
-
- gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
tmp = build_call_expr (gfor_fndecl_set_max_subrecord_length,
1,
- build_int_cst (gfc_c_int_type_node,
+ build_int_cst (integer_type_node,
gfc_option.max_subrecord_length));
gfc_add_expr_to_block (&body, tmp);
}
Index: trans-io.c
===================================================================
--- trans-io.c (revision 126992)
+++ trans-io.c (working copy)
@@ -276,7 +276,6 @@ gfc_build_io_library_fndecls (void)
tree types[IOPARM_type_num], pad_idx, gfc_int4_type_node;
tree gfc_intio_type_node;
tree parm_type, dt_parm_type;
- tree gfc_c_int_type_node;
HOST_WIDE_INT pad_size;
enum ioparam_type ptype;
@@ -300,8 +299,6 @@ gfc_build_io_library_fndecls (void)
TYPE_ALIGN (types[IOPARM_type_pad]) = MAX (TYPE_ALIGN (pchar_type_node),
TYPE_ALIGN (gfc_get_int_type (gfc_max_integer_kind)));
- gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind);
-
for (ptype = IOPARM_ptype_common; ptype < IOPARM_ptype_num; ptype++)
gfc_build_st_parameter (ptype, types);
@@ -342,7 +339,7 @@ gfc_build_io_library_fndecls (void)
gfc_build_library_function_decl (get_identifier
(PREFIX("transfer_array")),
void_type_node, 4, dt_parm_type,
- pvoid_type_node, gfc_c_int_type_node,
+ pvoid_type_node, integer_type_node,
gfc_charlen_type_node);
/* Library entry points */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, fortran] PR 32909 Replace gfc_c_int_type_node with integer_type_node
2007-07-27 19:56 [Patch, fortran] PR 32909 Replace gfc_c_int_type_node with integer_type_node Janne Blomqvist
@ 2007-07-27 22:04 ` FX Coudert
0 siblings, 0 replies; 2+ messages in thread
From: FX Coudert @ 2007-07-27 22:04 UTC (permalink / raw)
To: Janne Blomqvist; +Cc: gfortran, gcc-patches
> this is yet another obvious patch which I intend to commit in 24h,
> barring objections. In many places in the frontend we were creating
> a tree gfc_c_int_type_node to represent a C int. This is
> unnecessary, since the middle-end already defines such a tree,
> integer_type_node, which fwiw was already used in some places in
> gfortran.
Looks OK to me; I do remember introducing some of these occurences of
gfc_c_int_type_node myself! :-)
> 2007-07-27 Janne Blomqvist <jb@gcc.gnu.org>
>
> PR fortran/32909
> * trans-stmt.c (gfc_trans_character_select): Replace occurrences
> of gfc_c_int_type_node with integer_type_node.
> * trans-decl.c (gfc_build_intrinsic_function_decls): Likewise.
> (gfc_build_builtin_function_decls): Likewise.
> (gfc_generate_function_code): Likewise.
> * trans-io.c (gfc_build_io_library_fndecls): Likewise.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-27 20:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27 19:56 [Patch, fortran] PR 32909 Replace gfc_c_int_type_node with integer_type_node Janne Blomqvist
2007-07-27 22:04 ` FX Coudert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).