# HG changeset patch # User kent # Date 1248949321 -32400 # Node ID a4c410aa4714641565ea94e314af489ee57a9a89 # Parent 60db277cbe4d15d6ac4bded31286724426e82cde modifing gimple.[ch], cfgexpand.c to make gimple to support cbc goto flags. diff -r 60db277cbe4d -r a4c410aa4714 gcc/cbc-tree.h --- a/gcc/cbc-tree.h Wed Jul 29 13:46:47 2009 +0900 +++ b/gcc/cbc-tree.h Thu Jul 30 19:22:01 2009 +0900 @@ -10,6 +10,7 @@ //#define CbC_IS_CODE_SEGMENT(EXP) DECL_LANG_FLAG_7 (FUNCTION_DECL_CHECK (EXP)) //#define CbC_IS_CODE_SEGMENT(NODE) (TYPE_CHECK (NODE)->type.lang_flag_5) #define CbC_IS_CbC_GOTO(NODE) TREE_LANG_FLAG_5 (CALL_EXPR_CHECK(NODE)) +#define CALL_EXPR_CBC_GOTO(NODE) TREE_LANG_FLAG_5 (CALL_EXPR_CHECK(NODE)) extern tree cbc_return_f; extern tree cbc_env; diff -r 60db277cbe4d -r a4c410aa4714 gcc/cfgexpand.c --- a/gcc/cfgexpand.c Wed Jul 29 13:46:47 2009 +0900 +++ b/gcc/cfgexpand.c Thu Jul 30 19:22:01 2009 +0900 @@ -42,6 +42,9 @@ #include "tree-inline.h" #include "value-prof.h" #include "target.h" +#ifndef noCbC +#include "cbc-tree.h" +#endif /* Return an expression tree corresponding to the RHS of GIMPLE @@ -235,6 +238,9 @@ CALL_FROM_THUNK_P (t) = gimple_call_from_thunk_p (stmt); CALL_CANNOT_INLINE_P (t) = gimple_call_cannot_inline_p (stmt); CALL_EXPR_VA_ARG_PACK (t) = gimple_call_va_arg_pack_p (stmt); +#ifndef noCbC + CALL_EXPR_CBC_GOTO (t) = gimple_call_cbc_goto_p (stmt); +#endif /* If the call has a LHS then create a MODIFY_EXPR to hold it. */ { diff -r 60db277cbe4d -r a4c410aa4714 gcc/gimple.c --- a/gcc/gimple.c Wed Jul 29 13:46:47 2009 +0900 +++ b/gcc/gimple.c Thu Jul 30 19:22:01 2009 +0900 @@ -33,6 +33,9 @@ #include "tree-flow.h" #include "value-prof.h" #include "flags.h" +#ifndef noCbC +#include "cbc-tree.h" +#endif #define DEFGSCODE(SYM, NAME, STRUCT) NAME, const char *const gimple_code_name[] = { @@ -360,6 +363,9 @@ gimple_call_set_return_slot_opt (call, CALL_EXPR_RETURN_SLOT_OPT (t)); gimple_call_set_from_thunk (call, CALL_FROM_THUNK_P (t)); gimple_call_set_va_arg_pack (call, CALL_EXPR_VA_ARG_PACK (t)); +#ifndef noCbC + gimple_call_set_cbc_goto (call, CALL_EXPR_CBC_GOTO (t)); +#endif return call; } @@ -3188,6 +3194,9 @@ gimple_call_set_return_slot_opt (new_stmt, gimple_call_return_slot_opt_p (stmt)); gimple_call_set_from_thunk (new_stmt, gimple_call_from_thunk_p (stmt)); gimple_call_set_va_arg_pack (new_stmt, gimple_call_va_arg_pack_p (stmt)); +#ifndef noCbC + gimple_call_set_cbc_goto (new_stmt, gimple_call_cbc_goto_p (stmt)); +#endif return new_stmt; } diff -r 60db277cbe4d -r a4c410aa4714 gcc/gimple.h --- a/gcc/gimple.h Wed Jul 29 13:46:47 2009 +0900 +++ b/gcc/gimple.h Thu Jul 30 19:22:01 2009 +0900 @@ -101,6 +101,9 @@ GF_CALL_RETURN_SLOT_OPT = 1 << 2, GF_CALL_TAILCALL = 1 << 3, GF_CALL_VA_ARG_PACK = 1 << 4, +#ifndef noCbC + GF_CALL_CBC_GOTO = 1 << 5, +#endif GF_OMP_PARALLEL_COMBINED = 1 << 0, /* True on an GIMPLE_OMP_RETURN statement if the return does not require @@ -2088,6 +2091,21 @@ s->gsbase.subcode &= ~GF_CALL_TAILCALL; } +#ifndef noCbC +/* If CBCGOTO_P is true, mark call statement S as being a cbc goto + (i.e., a call just before the exit of a function). These calls are + candidate for tail call optimization. */ + +static inline void +gimple_call_set_cbc_goto (gimple s, bool cbcgoto_p) +{ + GIMPLE_CHECK (s, GIMPLE_CALL); + if (cbcgoto_p) + s->gsbase.subcode |= GF_CALL_CBC_GOTO; + else + s->gsbase.subcode &= ~GF_CALL_CBC_GOTO; +} +#endif /* Return true if GIMPLE_CALL S is marked as a tail call. */ @@ -2098,6 +2116,16 @@ return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0; } +#ifndef noCbC +/* Return true if GIMPLE_CALL S is marked as a cbc goto. */ + +static inline bool +gimple_call_cbc_goto_p (gimple s) +{ + GIMPLE_CHECK (s, GIMPLE_CALL); + return (s->gsbase.subcode & GF_CALL_CBC_GOTO) != 0; +} +#endif /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */