Newer
Older
/* Tree lowering pass. This pass converts the GENERIC functions-as-trees
tree representation into the GIMPLE form.
Copyright (C) 2002-2022 Free Software Foundation, Inc.
Major work done by Sebastian Pop <s.pop@laposte.net>,
Diego Novillo <dnovillo@redhat.com> and Jason Merrill <jason@redhat.com>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "rtl.h"
#include "tree-pass.h" /* FIXME: only for PROP_gimple_any */
#include "cgraph.h"
#include "tree-pretty-print.h"
#include "diagnostic-core.h"
#include "alias.h"
#include "calls.h"
#include "varasm.h"
#include "stmt.h"
#include "expr.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
Andrew MacLeod
committed
#include "gimplify.h"
#include "stor-layout.h"
#include "print-tree.h"
#include "tree-iterator.h"
#include "tree-inline.h"
#include "langhooks.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
#include "tree-hash-traits.h"
#include "omp-low.h"
#include "gomp-constants.h"
Jakub Jelinek
committed
#include "gimple-walk.h"
#include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name */
#include "builtins.h"
#include "stringpool.h"
#include "attribs.h"
#include "omp-offload.h"
#include "context.h"
/* Hash set of poisoned variables in a bind expr. */
static hash_set<tree> *asan_poisoned_variables = NULL;
GOVD_SEEN = 0x000001,
GOVD_EXPLICIT = 0x000002,
GOVD_SHARED = 0x000004,
GOVD_PRIVATE = 0x000008,
GOVD_FIRSTPRIVATE = 0x000010,
GOVD_LASTPRIVATE = 0x000020,
GOVD_REDUCTION = 0x000040,
GOVD_LOCAL = 0x00080,
GOVD_MAP = 0x000100,
GOVD_DEBUG_PRIVATE = 0x000200,
GOVD_PRIVATE_OUTER_REF = 0x000400,
GOVD_LINEAR = 0x000800,
GOVD_ALIGNED = 0x001000,
/* Flag for GOVD_MAP: don't copy back. */
GOVD_MAP_TO_ONLY = 0x002000,
Jakub Jelinek
committed
/* Flag for GOVD_LINEAR or GOVD_LASTPRIVATE: no outer reference. */
GOVD_LINEAR_LASTPRIVATE_NO_OUTER = 0x004000,
Jakub Jelinek
committed
GOVD_MAP_0LEN_ARRAY = 0x008000,
/* Flag for GOVD_MAP, if it is always, to or always, tofrom mapping. */
GOVD_MAP_ALWAYS_TO = 0x010000,
Jakub Jelinek
committed
/* Flag for shared vars that are or might be stored to in the region. */
GOVD_WRITTEN = 0x020000,
Jakub Jelinek
committed
/* Flag for GOVD_MAP, if it is a forced mapping. */
GOVD_MAP_FORCE = 0x040000,
/* Flag for GOVD_MAP: must be present already. */
GOVD_MAP_FORCE_PRESENT = 0x080000,
/* Flag for GOVD_MAP: only allocate. */
GOVD_MAP_ALLOC_ONLY = 0x100000,
/* Flag for GOVD_MAP: only copy back. */
GOVD_MAP_FROM_ONLY = 0x200000,
GOVD_NONTEMPORAL = 0x400000,
/* Flag for GOVD_LASTPRIVATE: conditional modifier. */
GOVD_LASTPRIVATE_CONDITIONAL = 0x800000,
GOVD_CONDTEMP = 0x1000000,
/* Flag for GOVD_REDUCTION: inscan seen in {in,ex}clusive clause. */
GOVD_REDUCTION_INSCAN = 0x2000000,
/* Flag for GOVD_FIRSTPRIVATE: OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT. */
GOVD_FIRSTPRIVATE_IMPLICIT = 0x4000000,
GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE
| GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LINEAR
| GOVD_LOCAL)
enum omp_region_type
{
Nathan Sidwell
committed
ORT_WORKSHARE = 0x00,
ORT_TASKGROUP = 0x01,
ORT_SIMD = 0x04,
Nathan Sidwell
committed
ORT_PARALLEL = 0x08,
ORT_COMBINED_PARALLEL = ORT_PARALLEL | 1,
Nathan Sidwell
committed
ORT_TASK = 0x10,
ORT_UNTIED_TASK = ORT_TASK | 1,
ORT_TASKLOOP = ORT_TASK | 2,
ORT_UNTIED_TASKLOOP = ORT_UNTIED_TASK | 2,
Nathan Sidwell
committed
ORT_TEAMS = 0x20,
ORT_COMBINED_TEAMS = ORT_TEAMS | 1,
ORT_HOST_TEAMS = ORT_TEAMS | 2,
ORT_COMBINED_HOST_TEAMS = ORT_COMBINED_TEAMS | 2,
Nathan Sidwell
committed
/* Data region. */
ORT_TARGET_DATA = 0x40,
Nathan Sidwell
committed
/* Data region with offloading. */
ORT_TARGET = 0x80,
ORT_COMBINED_TARGET = ORT_TARGET | 1,
ORT_IMPLICIT_TARGET = ORT_TARGET | 2,
Nathan Sidwell
committed
/* OpenACC variants. */
ORT_ACC = 0x100, /* A generic OpenACC region. */
Nathan Sidwell
committed
ORT_ACC_DATA = ORT_ACC | ORT_TARGET_DATA, /* Data construct. */
ORT_ACC_PARALLEL = ORT_ACC | ORT_TARGET, /* Parallel construct */
ORT_ACC_KERNELS = ORT_ACC | ORT_TARGET | 2, /* Kernels construct. */
ORT_ACC_SERIAL = ORT_ACC | ORT_TARGET | 4, /* Serial construct. */
ORT_ACC_HOST_DATA = ORT_ACC | ORT_TARGET_DATA | 2, /* Host data. */
Nathan Sidwell
committed
/* Dummy OpenMP region, used to disable expansion of
DECL_VALUE_EXPRs in taskloop pre body. */
Andrew MacLeod
committed
/* Gimplify hashtable helper. */
struct gimplify_hasher : free_ptr_hash <elt_t>
Andrew MacLeod
committed
{
static inline hashval_t hash (const elt_t *);
static inline bool equal (const elt_t *, const elt_t *);
Andrew MacLeod
committed
};
struct gimplify_ctx
{
struct gimplify_ctx *prev_context;
vec<gbind *> bind_expr_stack;
Andrew MacLeod
committed
tree temps;
gimple_seq conditional_cleanups;
tree exit_label;
tree return_temp;
vec<tree> case_labels;
hash_set<tree> *live_switch_vars;
Andrew MacLeod
committed
/* The formal temporary table. Should this be persistent? */
hash_table<gimplify_hasher> *temp_htab;
Andrew MacLeod
committed
int conditions;
Loading
Loading full blame...