mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
Make-lang.in (objc-lang.o): Depend on tree-gimple.h.
2005-04-13 Dale Johannesen <dalej@apple.com> * objc/Make-lang.in (objc-lang.o): Depend on tree-gimple.h. (objc-act.o): Ditto. * objc/objc-act.c (objc_gimplify_expr): New. (objc_get_callee_fndecl): New. * objc/objc-act.h: Include tree-gimple.h. Declare new functions. * objc/objc-lang.c (LANG_HOOKS_GIMPLIFY_EXPR): Define. (LANG_HOOKS_GET_CALLEE_FNDECL): Define. From-SVN: r98105
This commit is contained in:
parent
f3b2c50692
commit
43f479d63f
@ -1,3 +1,13 @@
|
||||
2005-04-13 Dale Johannesen <dalej@apple.com>
|
||||
|
||||
* objc/Make-lang.in (objc-lang.o): Depend on tree-gimple.h.
|
||||
(objc-act.o): Ditto.
|
||||
* objc/objc-act.c (objc_gimplify_expr): New.
|
||||
(objc_get_callee_fndecl): New.
|
||||
* objc/objc-act.h: Include tree-gimple.h. Declare new functions.
|
||||
* objc/objc-lang.c (LANG_HOOKS_GIMPLIFY_EXPR): Define.
|
||||
(LANG_HOOKS_GET_CALLEE_FNDECL): Define.
|
||||
|
||||
2005-04-13 Devang Patel <dpatel@apple.com>
|
||||
|
||||
* tree-if-conv.c (tree_if_convert_cond_expr): Do not create extra
|
||||
|
@ -60,13 +60,13 @@ objc/objc-lang.o : objc/objc-lang.c \
|
||||
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
|
||||
$(C_TREE_H) $(C_PRETTY_PRINT_H) $(DIAGNOSTIC_H) \
|
||||
$(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-objc.h \
|
||||
c-objc-common.h objc/objc-act.h
|
||||
c-objc-common.h objc/objc-act.h tree-gimple.h
|
||||
|
||||
objc/objc-act.o : objc/objc-act.c \
|
||||
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \
|
||||
$(EXPR_H) $(TARGET_H) $(C_TREE_H) diagnostic.h toplev.h flags.h \
|
||||
objc/objc-act.h input.h function.h output.h debug.h langhooks.h \
|
||||
$(LANGHOOKS_DEF_H) $(HASHTAB_H) c-pragma.h gt-objc-objc-act.h
|
||||
$(LANGHOOKS_DEF_H) $(HASHTAB_H) c-pragma.h gt-objc-objc-act.h tree-gimple.h
|
||||
|
||||
objc.srcextra:
|
||||
|
||||
|
@ -8569,4 +8569,53 @@ objc_lookup_ivar (tree other, tree id)
|
||||
return build_ivar_reference (id);
|
||||
}
|
||||
|
||||
/* Look for the special case of OBJC_TYPE_REF with the address of
|
||||
a function in OBJ_TYPE_REF_EXPR (presumably objc_msgSend or one
|
||||
of its cousins). */
|
||||
|
||||
enum gimplify_status objc_gimplify_expr (tree *expr_p, tree *pre_p,
|
||||
tree *post_p)
|
||||
{
|
||||
enum gimplify_status r0, r1;
|
||||
if (TREE_CODE (*expr_p) == OBJ_TYPE_REF
|
||||
&& TREE_CODE (OBJ_TYPE_REF_EXPR (*expr_p)) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (OBJ_TYPE_REF_EXPR (*expr_p), 0))
|
||||
== FUNCTION_DECL)
|
||||
{
|
||||
/* Postincrements in OBJ_TYPE_REF_OBJECT don't affect the
|
||||
value of the OBJ_TYPE_REF, so force them to be emitted
|
||||
during subexpression evaluation rather than after the
|
||||
OBJ_TYPE_REF. This permits objc_msgSend calls in Objective
|
||||
C to use direct rather than indirect calls when the
|
||||
object expression has a postincrement. */
|
||||
r0 = gimplify_expr (&OBJ_TYPE_REF_OBJECT (*expr_p), pre_p, NULL,
|
||||
is_gimple_val, fb_rvalue);
|
||||
r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p, post_p,
|
||||
is_gimple_val, fb_rvalue);
|
||||
return MIN (r0, r1);
|
||||
}
|
||||
return c_gimplify_expr (expr_p, pre_p, post_p);
|
||||
}
|
||||
|
||||
/* Given a CALL expression, find the function being called. The ObjC
|
||||
version looks for the OBJ_TYPE_REF_EXPR which is used for objc_msgSend. */
|
||||
|
||||
tree
|
||||
objc_get_callee_fndecl (tree call_expr)
|
||||
{
|
||||
tree addr = TREE_OPERAND (call_expr, 0);
|
||||
if (TREE_CODE (addr) != OBJ_TYPE_REF)
|
||||
return 0;
|
||||
|
||||
addr = OBJ_TYPE_REF_EXPR (addr);
|
||||
|
||||
/* If the address is just `&f' for some function `f', then we know
|
||||
that `f' is being called. */
|
||||
if (TREE_CODE (addr) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL)
|
||||
return TREE_OPERAND (addr, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "gt-objc-objc-act.h"
|
||||
|
@ -22,13 +22,18 @@ Boston, MA 02111-1307, USA. */
|
||||
#ifndef GCC_OBJC_ACT_H
|
||||
#define GCC_OBJC_ACT_H
|
||||
|
||||
/* For enum gimplify_status */
|
||||
#include "tree-gimple.h"
|
||||
|
||||
/*** Language hooks ***/
|
||||
|
||||
bool objc_init (void);
|
||||
const char *objc_printable_name (tree, int);
|
||||
tree objc_get_callee_fndecl (tree);
|
||||
void objc_finish_file (void);
|
||||
tree objc_fold_obj_type_ref (tree, tree);
|
||||
int objc_types_compatible_p (tree, tree);
|
||||
enum gimplify_status objc_gimplify_expr (tree *, tree *, tree *);
|
||||
|
||||
/* NB: The remaining public functions are prototyped in c-common.h, for the
|
||||
benefit of stub-objc.c and objc-act.c. */
|
||||
|
@ -47,6 +47,10 @@ enum c_language_kind c_language = clk_objc;
|
||||
#define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name
|
||||
#undef LANG_HOOKS_TYPES_COMPATIBLE_P
|
||||
#define LANG_HOOKS_TYPES_COMPATIBLE_P objc_types_compatible_p
|
||||
#undef LANG_HOOKS_GIMPLIFY_EXPR
|
||||
#define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr
|
||||
#undef LANG_HOOKS_GET_CALLEE_FNDECL
|
||||
#define LANG_HOOKS_GET_CALLEE_FNDECL objc_get_callee_fndecl
|
||||
|
||||
/* Each front end provides its own lang hook initializer. */
|
||||
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
||||
|
Loading…
Reference in New Issue
Block a user