summaryrefslogtreecommitdiff
path: root/gcc/gimple.h
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-14 19:00:56 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-14 19:00:56 +0000
commitddda25955ee583217ccbd7ad5c33c6bb9f304649 (patch)
treeed58c0f92eec5cacc819d56d29106d38a318e9ac /gcc/gimple.h
parent04fa393515487bde6dc2a0bc318398d983825365 (diff)
downloadgcc-ddda25955ee583217ccbd7ad5c33c6bb9f304649.tar.gz
2008-08-14 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r139100 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@139113 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r--gcc/gimple.h41
1 files changed, 34 insertions, 7 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 0c11f3ebfa7..2f6af03117e 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1834,6 +1834,17 @@ gimple_assign_set_rhs_code (gimple s, enum tree_code code)
}
+/* Return the gimple rhs class of the code of the expression computed on
+ the rhs of assignment statement GS.
+ This will never return GIMPLE_INVALID_RHS. */
+
+static inline enum gimple_rhs_class
+gimple_assign_rhs_class (const_gimple gs)
+{
+ return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
+}
+
+
/* Return true if S is a type-cast assignment. */
static inline bool
@@ -1894,7 +1905,7 @@ gimple_call_set_lhs (gimple gs, tree lhs)
/* Return the tree node representing the function called by call
- statement GS. This may or may not be a FUNCTION_DECL node. */
+ statement GS. */
static inline tree
gimple_call_fn (const_gimple gs)
@@ -1926,6 +1937,17 @@ gimple_call_set_fn (gimple gs, tree fn)
}
+/* Set FNDECL to be the function called by call statement GS. */
+
+static inline void
+gimple_call_set_fndecl (gimple gs, tree decl)
+{
+ GIMPLE_CHECK (gs, GIMPLE_CALL);
+ gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
+ gimple_set_op (gs, 1, build_fold_addr_expr (decl));
+}
+
+
/* 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. */
@@ -1933,8 +1955,13 @@ gimple_call_set_fn (gimple gs, tree fn)
static inline tree
gimple_call_fndecl (const_gimple gs)
{
- tree decl = gimple_call_fn (gs);
- return (TREE_CODE (decl) == FUNCTION_DECL) ? decl : NULL_TREE;
+ tree addr = gimple_call_fn (gs);
+ if (TREE_CODE (addr) == ADDR_EXPR)
+ {
+ gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
+ return TREE_OPERAND (addr, 0);
+ }
+ return NULL_TREE;
}
@@ -1946,9 +1973,9 @@ gimple_call_return_type (const_gimple gs)
tree fn = gimple_call_fn (gs);
tree type = TREE_TYPE (fn);
- /* See through pointers. */
- if (POINTER_TYPE_P (type))
- type = TREE_TYPE (type);
+ /* See through the pointer. */
+ gcc_assert (POINTER_TYPE_P (type));
+ type = TREE_TYPE (type);
gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE);
@@ -1986,7 +2013,7 @@ gimple_call_set_chain (gimple gs, tree chain)
GIMPLE_CHECK (gs, GIMPLE_CALL);
gcc_assert (chain == NULL
|| TREE_CODE (chain) == ADDR_EXPR
- || DECL_P (chain));
+ || SSA_VAR_P (chain));
gimple_set_op (gs, 2, chain);
}