summaryrefslogtreecommitdiff
path: root/gcc/fortran/f95-lang.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-27 10:13:12 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-27 10:13:12 +0000
commite0e4357b88efe5dc53e50d341a09de4d02331200 (patch)
treecafff2748190357bac05d69d344e79b0e38d1e27 /gcc/fortran/f95-lang.c
parent7b48bf2011b4020c4a5a2d5d4149b03983f72cc2 (diff)
downloadgcc-tarball-e0e4357b88efe5dc53e50d341a09de4d02331200.tar.gz
gcc-6.1.0gcc-6.1.0
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r--gcc/fortran/f95-lang.c217
1 files changed, 113 insertions, 104 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 85d0ee3118..b89a291e76 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -1,5 +1,5 @@
/* gfortran backend interface
- Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016 Free Software Foundation, Inc.
Contributed by Paul Brook.
This file is part of GCC.
@@ -24,42 +24,18 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
-#include "ansidecl.h"
-#include "system.h"
#include "coretypes.h"
-#include "gfortran.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "vec.h"
-#include "double-int.h"
-#include "input.h"
-#include "alias.h"
-#include "symtab.h"
-#include "options.h"
-#include "wide-int.h"
-#include "inchash.h"
+#include "target.h"
+#include "function.h"
#include "tree.h"
-#include "flags.h"
+#include "gfortran.h"
+#include "trans.h"
+#include "diagnostic.h" /* For errorcount/warningcount */
#include "langhooks.h"
#include "langhooks-def.h"
-#include "timevar.h"
-#include "tm.h"
-#include "hard-reg-set.h"
-#include "input.h"
-#include "function.h"
-#include "ggc.h"
#include "toplev.h"
-#include "target.h"
#include "debug.h"
-#include "diagnostic.h" /* For errorcount/warningcount */
-#include "dumpfile.h"
-#include "hash-map.h"
-#include "is-a.h"
-#include "plugin-api.h"
-#include "ipa-ref.h"
-#include "cgraph.h"
#include "cpp.h"
-#include "trans.h"
#include "trans-types.h"
#include "trans-const.h"
@@ -97,7 +73,6 @@ static bool global_bindings_p (void);
/* Each front end provides its own. */
static bool gfc_init (void);
static void gfc_finish (void);
-static void gfc_write_global_declarations (void);
static void gfc_be_parse_file (void);
static alias_set_type gfc_get_alias_set (tree);
static void gfc_init_ts (void);
@@ -118,13 +93,14 @@ static const struct attribute_spec gfc_attribute_table[] =
affects_type_identity } */
{ "omp declare target", 0, 0, true, false, false,
gfc_handle_omp_declare_target_attribute, false },
+ { "oacc function", 0, -1, true, false, false,
+ gfc_handle_omp_declare_target_attribute, false },
{ NULL, 0, 0, false, false, false, NULL, false }
};
#undef LANG_HOOKS_NAME
#undef LANG_HOOKS_INIT
#undef LANG_HOOKS_FINISH
-#undef LANG_HOOKS_WRITE_GLOBALS
#undef LANG_HOOKS_OPTION_LANG_MASK
#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
#undef LANG_HOOKS_INIT_OPTIONS
@@ -158,7 +134,6 @@ static const struct attribute_spec gfc_attribute_table[] =
#define LANG_HOOKS_NAME "GNU Fortran"
#define LANG_HOOKS_INIT gfc_init
#define LANG_HOOKS_FINISH gfc_finish
-#define LANG_HOOKS_WRITE_GLOBALS gfc_write_global_declarations
#define LANG_HOOKS_OPTION_LANG_MASK gfc_option_lang_mask
#define LANG_HOOKS_INIT_OPTIONS_STRUCT gfc_init_options_struct
#define LANG_HOOKS_INIT_OPTIONS gfc_init_options
@@ -222,25 +197,29 @@ gfc_create_decls (void)
static void
gfc_be_parse_file (void)
{
- int errors;
- int warnings;
-
gfc_create_decls ();
gfc_parse_file ();
gfc_generate_constructors ();
- /* Tell the frontend about any errors. */
- gfc_get_errors (&warnings, &errors);
- errorcount += errors;
- warningcount += warnings;
-
/* Clear the binding level stack. */
while (!global_bindings_p ())
poplevel (0, 0);
+ /* Finalize all of the globals.
+
+ Emulated tls lowering needs to see all TLS variables before we
+ call finalize_compilation_unit. The C/C++ front ends manage this
+ by calling decl_rest_of_compilation on each global and static
+ variable as they are seen. The Fortran front end waits until
+ here. */
+ for (tree decl = getdecls (); decl ; decl = DECL_CHAIN (decl))
+ rest_of_decl_compilation (decl, true, true);
+
/* Switch to the default tree diagnostics here, because there may be
diagnostics before gfc_finish(). */
gfc_diagnostics_finish ();
+
+ global_decl_processing ();
}
@@ -284,32 +263,6 @@ gfc_finish (void)
return;
}
-/* ??? This is something of a hack.
-
- Emulated tls lowering needs to see all TLS variables before we call
- finalize_compilation_unit. The C/C++ front ends manage this
- by calling decl_rest_of_compilation on each global and static variable
- as they are seen. The Fortran front end waits until this hook.
-
- A Correct solution is for finalize_compilation_unit not to be
- called during the WRITE_GLOBALS langhook, and have that hook only do what
- its name suggests and write out globals. But the C++ and Java front ends
- have (unspecified) problems with aliases that gets in the way. It has
- been suggested that these problems would be solved by completing the
- conversion to cgraph-based aliases. */
-
-static void
-gfc_write_global_declarations (void)
-{
- tree decl;
-
- /* Finalize all of the globals. */
- for (decl = getdecls(); decl ; decl = DECL_CHAIN (decl))
- rest_of_decl_compilation (decl, true, true);
-
- write_global_declarations ();
-}
-
/* These functions and variables deal with binding contours. We only
need these functions for the list of PARM_DECLs, but we leave the
functions more general; these are a simplified version of the
@@ -538,9 +491,8 @@ gfc_init_decl_processing (void)
global_binding_level = current_binding_level;
/* Build common tree nodes. char_type_node is unsigned because we
- only use it for actual characters, not for INTEGER(1). Also, we
- want double_type_node to actually have double precision. */
- build_common_tree_nodes (false, false);
+ only use it for actual characters, not for INTEGER(1). */
+ build_common_tree_nodes (false);
void_list_node = build_tree_list (NULL_TREE, void_type_node);
@@ -672,12 +624,19 @@ gfc_init_builtin_functions (void)
ARG6, ARG7) NAME,
#define DEF_FUNCTION_TYPE_8(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
ARG6, ARG7, ARG8) NAME,
+#define DEF_FUNCTION_TYPE_9(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6, ARG7, ARG8, ARG9) NAME,
+#define DEF_FUNCTION_TYPE_10(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6, ARG7, ARG8, ARG9, ARG10) NAME,
+#define DEF_FUNCTION_TYPE_11(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) NAME,
#define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
+#define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
#define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
+#define DEF_FUNCTION_TYPE_VAR_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6) NAME,
#define DEF_FUNCTION_TYPE_VAR_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
ARG6, ARG7) NAME,
-#define DEF_FUNCTION_TYPE_VAR_11(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
- ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) NAME,
#define DEF_POINTER_TYPE(NAME, TYPE) NAME,
#include "types.def"
#undef DEF_PRIMITIVE_TYPE
@@ -690,10 +649,14 @@ gfc_init_builtin_functions (void)
#undef DEF_FUNCTION_TYPE_6
#undef DEF_FUNCTION_TYPE_7
#undef DEF_FUNCTION_TYPE_8
+#undef DEF_FUNCTION_TYPE_9
+#undef DEF_FUNCTION_TYPE_10
+#undef DEF_FUNCTION_TYPE_11
#undef DEF_FUNCTION_TYPE_VAR_0
+#undef DEF_FUNCTION_TYPE_VAR_1
#undef DEF_FUNCTION_TYPE_VAR_2
+#undef DEF_FUNCTION_TYPE_VAR_6
#undef DEF_FUNCTION_TYPE_VAR_7
-#undef DEF_FUNCTION_TYPE_VAR_11
#undef DEF_POINTER_TYPE
BT_LAST
};
@@ -1014,37 +977,36 @@ gfc_init_builtin_functions (void)
gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
"realloc", ATTR_NOTHROW_LEAF_LIST);
- ftype = build_function_type_list (integer_type_node,
- void_type_node, NULL_TREE);
- gfc_define_builtin ("__builtin_isnan", ftype, BUILT_IN_ISNAN,
- "__builtin_isnan", ATTR_CONST_NOTHROW_LEAF_LIST);
+ /* Type-generic floating-point classification built-ins. */
+
+ ftype = build_function_type (integer_type_node, NULL_TREE);
gfc_define_builtin ("__builtin_isfinite", ftype, BUILT_IN_ISFINITE,
"__builtin_isfinite", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_isinf", ftype, BUILT_IN_ISINF,
+ "__builtin_isinf", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_isinf_sign", ftype, BUILT_IN_ISINF_SIGN,
+ "__builtin_isinf_sign", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_isnan", ftype, BUILT_IN_ISNAN,
+ "__builtin_isnan", ATTR_CONST_NOTHROW_LEAF_LIST);
gfc_define_builtin ("__builtin_isnormal", ftype, BUILT_IN_ISNORMAL,
"__builtin_isnormal", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_signbit", ftype, BUILT_IN_SIGNBIT,
+ "__builtin_signbit", ATTR_CONST_NOTHROW_LEAF_LIST);
- ftype = build_function_type_list (integer_type_node, void_type_node,
- void_type_node, NULL_TREE);
- gfc_define_builtin ("__builtin_isunordered", ftype, BUILT_IN_ISUNORDERED,
- "__builtin_isunordered", ATTR_CONST_NOTHROW_LEAF_LIST);
+ ftype = build_function_type (integer_type_node, NULL_TREE);
+ gfc_define_builtin ("__builtin_isless", ftype, BUILT_IN_ISLESS,
+ "__builtin_isless", ATTR_CONST_NOTHROW_LEAF_LIST);
gfc_define_builtin ("__builtin_islessequal", ftype, BUILT_IN_ISLESSEQUAL,
"__builtin_islessequal", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_islessgreater", ftype, BUILT_IN_ISLESSGREATER,
+ "__builtin_islessgreater", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_isgreater", ftype, BUILT_IN_ISGREATER,
+ "__builtin_isgreater", ATTR_CONST_NOTHROW_LEAF_LIST);
gfc_define_builtin ("__builtin_isgreaterequal", ftype,
BUILT_IN_ISGREATEREQUAL, "__builtin_isgreaterequal",
ATTR_CONST_NOTHROW_LEAF_LIST);
-
- ftype = build_function_type_list (integer_type_node,
- float_type_node, NULL_TREE);
- gfc_define_builtin("__builtin_signbitf", ftype, BUILT_IN_SIGNBITF,
- "signbitf", ATTR_CONST_NOTHROW_LEAF_LIST);
- ftype = build_function_type_list (integer_type_node,
- double_type_node, NULL_TREE);
- gfc_define_builtin("__builtin_signbit", ftype, BUILT_IN_SIGNBIT,
- "signbit", ATTR_CONST_NOTHROW_LEAF_LIST);
- ftype = build_function_type_list (integer_type_node,
- long_double_type_node, NULL_TREE);
- gfc_define_builtin("__builtin_signbitl", ftype, BUILT_IN_SIGNBITL,
- "signbitl", ATTR_CONST_NOTHROW_LEAF_LIST);
+ gfc_define_builtin ("__builtin_isunordered", ftype, BUILT_IN_ISUNORDERED,
+ "__builtin_isunordered", ATTR_CONST_NOTHROW_LEAF_LIST);
#define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
@@ -1124,18 +1086,68 @@ gfc_init_builtin_functions (void)
builtin_types[(int) ARG7], \
builtin_types[(int) ARG8], \
NULL_TREE);
+#define DEF_FUNCTION_TYPE_9(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6, ARG7, ARG8, ARG9) \
+ builtin_types[(int) ENUM] \
+ = build_function_type_list (builtin_types[(int) RETURN], \
+ builtin_types[(int) ARG1], \
+ builtin_types[(int) ARG2], \
+ builtin_types[(int) ARG3], \
+ builtin_types[(int) ARG4], \
+ builtin_types[(int) ARG5], \
+ builtin_types[(int) ARG6], \
+ builtin_types[(int) ARG7], \
+ builtin_types[(int) ARG8], \
+ builtin_types[(int) ARG9], \
+ NULL_TREE);
+#define DEF_FUNCTION_TYPE_10(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, \
+ ARG5, ARG6, ARG7, ARG8, ARG9, ARG10) \
+ builtin_types[(int) ENUM] \
+ = build_function_type_list (builtin_types[(int) RETURN], \
+ builtin_types[(int) ARG1], \
+ builtin_types[(int) ARG2], \
+ builtin_types[(int) ARG3], \
+ builtin_types[(int) ARG4], \
+ builtin_types[(int) ARG5], \
+ builtin_types[(int) ARG6], \
+ builtin_types[(int) ARG7], \
+ builtin_types[(int) ARG8], \
+ builtin_types[(int) ARG9], \
+ builtin_types[(int) ARG10], \
+ NULL_TREE);
+#define DEF_FUNCTION_TYPE_11(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, \
+ ARG5, ARG6, ARG7, ARG8, ARG9, ARG10, ARG11)\
+ builtin_types[(int) ENUM] \
+ = build_function_type_list (builtin_types[(int) RETURN], \
+ builtin_types[(int) ARG1], \
+ builtin_types[(int) ARG2], \
+ builtin_types[(int) ARG3], \
+ builtin_types[(int) ARG4], \
+ builtin_types[(int) ARG5], \
+ builtin_types[(int) ARG6], \
+ builtin_types[(int) ARG7], \
+ builtin_types[(int) ARG8], \
+ builtin_types[(int) ARG9], \
+ builtin_types[(int) ARG10], \
+ builtin_types[(int) ARG11], \
+ NULL_TREE);
#define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
builtin_types[(int) ENUM] \
= build_varargs_function_type_list (builtin_types[(int) RETURN], \
NULL_TREE);
+#define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
+ builtin_types[(int) ENUM] \
+ = build_varargs_function_type_list (builtin_types[(int) RETURN], \
+ builtin_types[(int) ARG1], \
+ NULL_TREE);
#define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
builtin_types[(int) ENUM] \
= build_varargs_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
builtin_types[(int) ARG2], \
NULL_TREE);
-#define DEF_FUNCTION_TYPE_VAR_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
- ARG6, ARG7) \
+#define DEF_FUNCTION_TYPE_VAR_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6) \
builtin_types[(int) ENUM] \
= build_varargs_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
@@ -1144,10 +1156,9 @@ gfc_init_builtin_functions (void)
builtin_types[(int) ARG4], \
builtin_types[(int) ARG5], \
builtin_types[(int) ARG6], \
- builtin_types[(int) ARG7], \
NULL_TREE);
-#define DEF_FUNCTION_TYPE_VAR_11(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
- ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) \
+#define DEF_FUNCTION_TYPE_VAR_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
+ ARG6, ARG7) \
builtin_types[(int) ENUM] \
= build_varargs_function_type_list (builtin_types[(int) RETURN], \
builtin_types[(int) ARG1], \
@@ -1157,10 +1168,6 @@ gfc_init_builtin_functions (void)
builtin_types[(int) ARG5], \
builtin_types[(int) ARG6], \
builtin_types[(int) ARG7], \
- builtin_types[(int) ARG8], \
- builtin_types[(int) ARG9], \
- builtin_types[(int) ARG10], \
- builtin_types[(int) ARG11], \
NULL_TREE);
#define DEF_POINTER_TYPE(ENUM, TYPE) \
builtin_types[(int) ENUM] \
@@ -1176,10 +1183,12 @@ gfc_init_builtin_functions (void)
#undef DEF_FUNCTION_TYPE_6
#undef DEF_FUNCTION_TYPE_7
#undef DEF_FUNCTION_TYPE_8
+#undef DEF_FUNCTION_TYPE_10
#undef DEF_FUNCTION_TYPE_VAR_0
+#undef DEF_FUNCTION_TYPE_VAR_1
#undef DEF_FUNCTION_TYPE_VAR_2
+#undef DEF_FUNCTION_TYPE_VAR_6
#undef DEF_FUNCTION_TYPE_VAR_7
-#undef DEF_FUNCTION_TYPE_VAR_11
#undef DEF_POINTER_TYPE
builtin_types[(int) BT_LAST] = NULL_TREE;