]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/tree-ssa-operands.h
[testsuite] Add missing dg-require-effective-target label_values
[thirdparty/gcc.git] / gcc / tree-ssa-operands.h
CommitLineData
4ee9c684 1/* SSA operand management for trees.
fbd26352 2 Copyright (C) 2003-2019 Free Software Foundation, Inc.
4ee9c684 3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8c4c00c1 8Software Foundation; either version 3, or (at your option) any later
4ee9c684 9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
8c4c00c1 17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
4ee9c684 19
20#ifndef GCC_TREE_SSA_OPERANDS_H
21#define GCC_TREE_SSA_OPERANDS_H
22
23/* Interface to SSA operands. */
24
56004dc5 25
26/* This represents a pointer to a DEF operand. */
b66731e8 27typedef tree *def_operand_p;
56004dc5 28
29/* This represents a pointer to a USE operand. */
b66731e8 30typedef ssa_use_operand_t *use_operand_p;
56004dc5 31
b66731e8 32/* NULL operand types. */
dd277d48 33#define NULL_USE_OPERAND_P ((use_operand_p)NULL)
34#define NULL_DEF_OPERAND_P ((def_operand_p)NULL)
56004dc5 35
56004dc5 36/* This represents the USE operands of a stmt. */
48e1416a 37struct use_optype_d
5b110d39 38{
b66731e8 39 struct use_optype_d *next;
b3e7c666 40 struct ssa_use_operand_t use_ptr;
b66731e8 41};
42typedef struct use_optype_d *use_optype_p;
5b110d39 43
dadb7503 44/* This structure represents a variable sized buffer which is allocated by the
d819917f 45 operand memory manager. Operands are suballocated out of this block. The
dadb7503 46 MEM array varies in size. */
48e1416a 47
25a27413 48struct GTY((chain_next("%h.next"))) ssa_operand_memory_d {
b66731e8 49 struct ssa_operand_memory_d *next;
dadb7503 50 char mem[1];
b66731e8 51};
2cf24776 52
fcbe34ba 53/* Per-function operand caches. */
fb1e4f4a 54struct GTY(()) ssa_operands {
fcbe34ba 55 struct ssa_operand_memory_d *operand_memory;
56 unsigned operand_memory_index;
363d040e 57 /* Current size of the operand memory buffer. */
58 unsigned int ssa_operand_mem_size;
fcbe34ba 59
60 bool ops_active;
61
fcbe34ba 62 struct use_optype_d * GTY ((skip (""))) free_uses;
b66731e8 63};
48e1416a 64
b66731e8 65#define USE_FROM_PTR(PTR) get_use_from_ptr (PTR)
66#define DEF_FROM_PTR(PTR) get_def_from_ptr (PTR)
67#define SET_USE(USE, V) set_ssa_use_from_ptr (USE, V)
68#define SET_DEF(DEF, V) ((*(DEF)) = (V))
69
75a70cf9 70#define USE_STMT(USE) (USE)->loc.stmt
b66731e8 71
72#define USE_OP_PTR(OP) (&((OP)->use_ptr))
73#define USE_OP(OP) (USE_FROM_PTR (USE_OP_PTR (OP)))
74
75a70cf9 75#define PHI_RESULT_PTR(PHI) gimple_phi_result_ptr (PHI)
56004dc5 76#define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI))
77#define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V))
8f6fa493 78/*
56004dc5 79#define PHI_ARG_DEF(PHI, I) USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I)))
8f6fa493 80*/
81#define PHI_ARG_DEF_PTR(PHI, I) gimple_phi_arg_imm_use_ptr ((PHI), (I))
82#define PHI_ARG_DEF(PHI, I) gimple_phi_arg_def ((PHI), (I))
56004dc5 83#define SET_PHI_ARG_DEF(PHI, I, V) \
84 SET_USE (PHI_ARG_DEF_PTR ((PHI), (I)), (V))
85#define PHI_ARG_DEF_FROM_EDGE(PHI, E) \
77ae8b0f 86 PHI_ARG_DEF ((PHI), (E)->dest_idx)
56004dc5 87#define PHI_ARG_DEF_PTR_FROM_EDGE(PHI, E) \
77ae8b0f 88 PHI_ARG_DEF_PTR ((PHI), (E)->dest_idx)
22aa74c4 89#define PHI_ARG_INDEX_FROM_USE(USE) phi_arg_index_from_use (USE)
56004dc5 90
2cf24776 91
8f6fa493 92extern bool ssa_operands_active (struct function *);
5084b2e4 93extern void init_ssa_operands (struct function *fn);
861b4e39 94extern void fini_ssa_operands (struct function *);
42acab1c 95extern bool verify_ssa_operands (struct function *, gimple *stmt);
96extern void free_stmt_operands (struct function *, gimple *);
97extern void update_stmt_operands (struct function *, gimple *);
98extern void swap_ssa_operands (gimple *, tree *, tree *);
22aa74c4 99extern bool verify_imm_links (FILE *f, tree var);
100
22aa74c4 101extern void dump_immediate_uses_for (FILE *file, tree var);
8f6fa493 102extern void dump_immediate_uses (FILE *file);
22aa74c4 103extern void debug_immediate_uses (void);
104extern void debug_immediate_uses_for (tree var);
b66731e8 105
42acab1c 106extern void unlink_stmt_vdef (gimple *);
260e7e11 107
8f6fa493 108/* Return the tree pointed-to by USE. */
109static inline tree
110get_use_from_ptr (use_operand_p use)
111{
112 return *(use->use);
113}
43daa21e 114
8f6fa493 115/* Return the tree pointed-to by DEF. */
116static inline tree
117get_def_from_ptr (def_operand_p def)
43daa21e 118{
8f6fa493 119 return *def;
120}
b66731e8 121
4ee9c684 122#endif /* GCC_TREE_SSA_OPERANDS_H */