Commit 2a0603f1 by Andrew MacLeod Committed by Andrew Macleod

gimple.h: Move some prototypes to gimple-expr.h and add to include list.



	* gimple.h: Move some prototypes to gimple-expr.h and add to include
	list.
	(extract_ops_from_tree, gimple_call_addr_fndecl, is_gimple_reg_type):
	Move to gimple-expr.h.
	* gimple-expr.h: New file.  Relocate some prototypes from gimple.h.
	(types_compatible_p, is_gimple_reg_type, is_gimple_variable,
	is_gimple_id, virtual_operand_p, is_gimple_addressable,
	is_gimple_constant, extract_ops_from_tree, gimple_call_addr_fndecl):
	Relocate here.
	* gimple.c (extract_ops_from_tree_1, gimple_cond_get_ops_from_tree,
	gimple_set_body, gimple_body, gimple_has_body_p, is_gimple_lvalue,
	is_gimple_condexpr, is_gimple_addressable, is_gimple_constant,
	is_gimple_address, is_gimple_invariant_address,
	is_gimple_ip_invariant_address, is_gimple_min_invariant,
	is_gimple_ip_invariant, is_gimple_variable, is_gimple_id,
	virtual_operand_p, is_gimple_reg, is_gimple_val, is_gimple_asm_val,
	is_gimple_min_lval, is_gimple_call_addr, is_gimple_mem_ref_addr,
	gimple_decl_printable_name, useless_type_conversion_p,
	types_compatible_p, gimple_can_coalesce_p, copy_var_decl): Move to 
	gimple-expr.[ch].
	* gimple-expr.c: New File.
	(useless_type_conversion_p, gimple_set_body, gimple_body,
	gimple_has_body_p, gimple_decl_printable_name, copy_var_decl,
	gimple_can_coalesce_p, extract_ops_from_tree_1, 
	gimple_cond_get_ops_from_tree, is_gimple_lvalue, is_gimple_condexpr,
	is_gimple_address, is_gimple_invariant_address,
	is_gimple_ip_invariant_address, is_gimple_min_invariant,
	is_gimple_ip_invariant, is_gimple_reg, is_gimple_val,
	is_gimple_asm_val, is_gimple_min_lval, is_gimple_call_addr,
	is_gimple_mem_ref_addr): Relocate here.
	* Makefile.in (OBJS): Add gimple-expr.o.

From-SVN: r204412
parent c180e495
2013-11-05 Andrew MacLeod <amacleod@redhat.com>
* gimple.h: Move some prototypes to gimple-expr.h and add to include
list.
(extract_ops_from_tree, gimple_call_addr_fndecl, is_gimple_reg_type):
Move to gimple-expr.h.
* gimple-expr.h: New file. Relocate some prototypes from gimple.h.
(types_compatible_p, is_gimple_reg_type, is_gimple_variable,
is_gimple_id, virtual_operand_p, is_gimple_addressable,
is_gimple_constant, extract_ops_from_tree, gimple_call_addr_fndecl):
Relocate here.
* gimple.c (extract_ops_from_tree_1, gimple_cond_get_ops_from_tree,
gimple_set_body, gimple_body, gimple_has_body_p, is_gimple_lvalue,
is_gimple_condexpr, is_gimple_addressable, is_gimple_constant,
is_gimple_address, is_gimple_invariant_address,
is_gimple_ip_invariant_address, is_gimple_min_invariant,
is_gimple_ip_invariant, is_gimple_variable, is_gimple_id,
virtual_operand_p, is_gimple_reg, is_gimple_val, is_gimple_asm_val,
is_gimple_min_lval, is_gimple_call_addr, is_gimple_mem_ref_addr,
gimple_decl_printable_name, useless_type_conversion_p,
types_compatible_p, gimple_can_coalesce_p, copy_var_decl): Move to
gimple-expr.[ch].
* gimple-expr.c: New File.
(useless_type_conversion_p, gimple_set_body, gimple_body,
gimple_has_body_p, gimple_decl_printable_name, copy_var_decl,
gimple_can_coalesce_p, extract_ops_from_tree_1,
gimple_cond_get_ops_from_tree, is_gimple_lvalue, is_gimple_condexpr,
is_gimple_address, is_gimple_invariant_address,
is_gimple_ip_invariant_address, is_gimple_min_invariant,
is_gimple_ip_invariant, is_gimple_reg, is_gimple_val,
is_gimple_asm_val, is_gimple_min_lval, is_gimple_call_addr,
is_gimple_mem_ref_addr): Relocate here.
* Makefile.in (OBJS): Add gimple-expr.o.
2013-11-05 David Malcolm <dmalcolm@redhat.com>
* gengtype-parse.c (struct_field_seq): Support empty structs.
......@@ -1230,6 +1230,7 @@ OBJS = \
ggc-common.o \
gimple.o \
gimple-builder.o \
gimple-expr.o \
gimple-iterator.o \
gimple-fold.o \
gimple-low.o \
......
/* Header file for gimple decl, type and expressions.
Copyright (C) 2013 Free Software Foundation, Inc.
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/>. */
#ifndef GCC_GIMPLE_EXPR_H
#define GCC_GIMPLE_EXPR_H
extern bool useless_type_conversion_p (tree, tree);
extern void gimple_set_body (tree, gimple_seq);
extern gimple_seq gimple_body (tree);
extern bool gimple_has_body_p (tree);
extern const char *gimple_decl_printable_name (tree, int);
extern tree copy_var_decl (tree, tree, tree);
extern bool gimple_can_coalesce_p (tree, tree);
extern void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *,
tree *);
extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *,
tree *);
extern bool is_gimple_lvalue (tree);
extern bool is_gimple_condexpr (tree);
extern bool is_gimple_address (const_tree);
extern bool is_gimple_invariant_address (const_tree);
extern bool is_gimple_ip_invariant_address (const_tree);
extern bool is_gimple_min_invariant (const_tree);
extern bool is_gimple_ip_invariant (const_tree);
extern bool is_gimple_reg (tree);
extern bool is_gimple_val (tree);
extern bool is_gimple_asm_val (tree);
extern bool is_gimple_min_lval (tree);
extern bool is_gimple_call_addr (tree);
extern bool is_gimple_mem_ref_addr (tree);
/* Return true if a conversion from either type of TYPE1 and TYPE2
to the other is not required. Otherwise return false. */
static inline bool
types_compatible_p (tree type1, tree type2)
{
return (type1 == type2
|| (useless_type_conversion_p (type1, type2)
&& useless_type_conversion_p (type2, type1)));
}
/* Return true if TYPE is a suitable type for a scalar register variable. */
static inline bool
is_gimple_reg_type (tree type)
{
return !AGGREGATE_TYPE_P (type);
}
/* Return true if T is a variable. */
static inline bool
is_gimple_variable (tree t)
{
return (TREE_CODE (t) == VAR_DECL
|| TREE_CODE (t) == PARM_DECL
|| TREE_CODE (t) == RESULT_DECL
|| TREE_CODE (t) == SSA_NAME);
}
/* Return true if T is a GIMPLE identifier (something with an address). */
static inline bool
is_gimple_id (tree t)
{
return (is_gimple_variable (t)
|| TREE_CODE (t) == FUNCTION_DECL
|| TREE_CODE (t) == LABEL_DECL
|| TREE_CODE (t) == CONST_DECL
/* Allow string constants, since they are addressable. */
|| TREE_CODE (t) == STRING_CST);
}
/* Return true if OP, an SSA name or a DECL is a virtual operand. */
static inline bool
virtual_operand_p (tree op)
{
if (TREE_CODE (op) == SSA_NAME)
{
op = SSA_NAME_VAR (op);
if (!op)
return false;
}
if (TREE_CODE (op) == VAR_DECL)
return VAR_DECL_IS_VIRTUAL_OPERAND (op);
return false;
}
/* Return true if T is something whose address can be taken. */
static inline bool
is_gimple_addressable (tree t)
{
return (is_gimple_id (t) || handled_component_p (t)
|| TREE_CODE (t) == MEM_REF);
}
/* Return true if T is a valid gimple constant. */
static inline bool
is_gimple_constant (const_tree t)
{
switch (TREE_CODE (t))
{
case INTEGER_CST:
case REAL_CST:
case FIXED_CST:
case STRING_CST:
case COMPLEX_CST:
case VECTOR_CST:
return true;
default:
return false;
}
}
/* A wrapper around extract_ops_from_tree_1, for callers which expect
to see only a maximum of two operands. */
static inline void
extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
tree *op1)
{
tree op2;
extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
gcc_assert (op2 == NULL_TREE);
}
/* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
associated with the callee if known. Otherwise return NULL_TREE. */
static inline tree
gimple_call_addr_fndecl (const_tree fn)
{
if (fn && TREE_CODE (fn) == ADDR_EXPR)
{
tree fndecl = TREE_OPERAND (fn, 0);
if (TREE_CODE (fndecl) == MEM_REF
&& TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
&& integer_zerop (TREE_OPERAND (fndecl, 1)))
fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
if (TREE_CODE (fndecl) == FUNCTION_DECL)
return fndecl;
}
return NULL_TREE;
}
#endif /* GCC_GIMPLE_EXPR_H */
......@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "internal-fn.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "gimple-expr.h"
typedef gimple gimple_seq_node;
......@@ -745,8 +746,6 @@ gimple gimple_build_return (tree);
gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
#define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
gimple
gimple_build_assign_with_ops (enum tree_code, tree,
tree, tree CXX_MEM_STAT_INFO);
......@@ -809,9 +808,6 @@ gimple gimple_build_predict (enum br_predictor, enum prediction);
enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
void sort_case_labels (vec<tree> );
void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
void gimple_set_body (tree, gimple_seq);
gimple_seq gimple_body (tree);
bool gimple_has_body_p (tree);
gimple_seq gimple_seq_alloc (void);
void gimple_seq_free (gimple_seq);
void gimple_seq_add_seq (gimple_seq *, gimple_seq);
......@@ -832,7 +828,6 @@ tree gimple_get_lhs (const_gimple);
void gimple_set_lhs (gimple, tree);
void gimple_replace_lhs (gimple, tree);
gimple gimple_copy (gimple);
void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
gimple gimple_build_cond_from_tree (tree, tree, tree);
void gimple_cond_set_condition_from_tree (gimple, tree);
bool gimple_has_side_effects (const_gimple);
......@@ -844,48 +839,6 @@ bool empty_body_p (gimple_seq);
unsigned get_gimple_rhs_num_ops (enum tree_code);
#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
const char *gimple_decl_printable_name (tree, int);
/* Returns true iff T is a virtual ssa name decl. */
extern bool virtual_operand_p (tree);
/* Returns true iff T is a scalar register variable. */
extern bool is_gimple_reg (tree);
/* Returns true iff T is any sort of variable. */
extern bool is_gimple_variable (tree);
/* Returns true iff T is any sort of symbol. */
extern bool is_gimple_id (tree);
/* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
extern bool is_gimple_min_lval (tree);
/* Returns true iff T is something whose address can be taken. */
extern bool is_gimple_addressable (tree);
/* Returns true iff T is any valid GIMPLE lvalue. */
extern bool is_gimple_lvalue (tree);
/* Returns true iff T is a GIMPLE address. */
bool is_gimple_address (const_tree);
/* Returns true iff T is a GIMPLE invariant address. */
bool is_gimple_invariant_address (const_tree);
/* Returns true iff T is a GIMPLE invariant address at interprocedural
level. */
bool is_gimple_ip_invariant_address (const_tree);
/* Returns true iff T is a valid GIMPLE constant. */
bool is_gimple_constant (const_tree);
/* Returns true iff T is a GIMPLE restricted function invariant. */
extern bool is_gimple_min_invariant (const_tree);
/* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
extern bool is_gimple_ip_invariant (const_tree);
/* Returns true iff T is a GIMPLE rvalue. */
extern bool is_gimple_val (tree);
/* Returns true iff T is a GIMPLE asm statement input. */
extern bool is_gimple_asm_val (tree);
/* Returns true iff T is a valid address operand of a MEM_REF. */
bool is_gimple_mem_ref_addr (tree);
/* Returns true iff T is a valid if-statement condition. */
extern bool is_gimple_condexpr (tree);
/* Returns true iff T is a valid call address expression. */
extern bool is_gimple_call_addr (tree);
/* Return TRUE iff stmt is a call to a built-in function. */
extern bool is_gimple_builtin_call (gimple stmt);
......@@ -906,8 +859,6 @@ extern bool gimple_ior_addresses_taken (bitmap, gimple);
extern bool gimple_call_builtin_p (gimple, enum built_in_class);
extern bool gimple_call_builtin_p (gimple, enum built_in_function);
extern bool gimple_asm_clobbers_memory_p (const_gimple);
extern bool useless_type_conversion_p (tree, tree);
extern bool types_compatible_p (tree, tree);
/* In gimplify.c */
extern tree create_tmp_var_raw (tree, const char *);
......@@ -1086,9 +1037,7 @@ extern tree gimple_boolify (tree);
extern gimple_predicate rhs_predicate_for (tree);
extern tree canonicalize_cond_expr_cond (tree);
extern void dump_decl_set (FILE *, bitmap);
extern bool gimple_can_coalesce_p (tree, tree);
extern bool nonfreeing_call_p (gimple);
extern tree copy_var_decl (tree, tree, tree);
/* In trans-mem.c. */
extern void diagnose_tm_safe_errors (tree);
......@@ -2042,18 +1991,6 @@ gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
}
/* A wrapper around extract_ops_from_tree_1, for callers which expect
to see only a maximum of two operands. */
static inline void
extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
tree *op1)
{
tree op2;
extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
gcc_assert (op2 == NULL_TREE);
}
/* Returns true if GS is a nontemporal move. */
static inline bool
......@@ -2316,25 +2253,6 @@ gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
}
/* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
associated with the callee if known. Otherwise return NULL_TREE. */
static inline tree
gimple_call_addr_fndecl (const_tree fn)
{
if (fn && TREE_CODE (fn) == ADDR_EXPR)
{
tree fndecl = TREE_OPERAND (fn, 0);
if (TREE_CODE (fndecl) == MEM_REF
&& TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
&& integer_zerop (TREE_OPERAND (fndecl, 1)))
fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
if (TREE_CODE (fndecl) == FUNCTION_DECL)
return fndecl;
}
return NULL_TREE;
}
/* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
Otherwise return NULL. This function is analogous to
get_callee_fndecl in tree land. */
......@@ -5385,14 +5303,6 @@ gimple_expr_type (const_gimple stmt)
return void_type_node;
}
/* Return true if TYPE is a suitable type for a scalar register variable. */
static inline bool
is_gimple_reg_type (tree type)
{
return !AGGREGATE_TYPE_P (type);
}
/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
static inline gimple_stmt_iterator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment