* ObjC: some minor optimizations
@ 2011-04-11 17:09 Nicola Pero
2011-04-11 22:07 ` Mike Stump
0 siblings, 1 reply; 2+ messages in thread
From: Nicola Pero @ 2011-04-11 17:09 UTC (permalink / raw)
To: gcc-patches
This patch removes some very minor inefficiencies in the ObjC compiler code.
Ok to commit ?
Thanks
Index: gcc/objc/ChangeLog
===================================================================
--- gcc/objc/ChangeLog (revision 172239)
+++ gcc/objc/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2011-04-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-act.c (objc_is_class_name, objc_is_id): For efficiency,
+ avoid calling identifier_global_value() multiple times.
+
2011-04-06 Joseph Myers <joseph@codesourcery.com>
* objc-act.c: Include c-target.h instead of target.h.
Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c (revision 172239)
+++ gcc/objc/objc-act.c (working copy)
@@ -3411,9 +3411,13 @@ objc_is_class_name (tree ident)
{
hash target;
- if (ident && TREE_CODE (ident) == IDENTIFIER_NODE
- && identifier_global_value (ident))
- ident = identifier_global_value (ident);
+ if (ident && TREE_CODE (ident) == IDENTIFIER_NODE)
+ {
+ tree t = identifier_global_value (ident);
+ if (t)
+ ident = t;
+ }
+
while (ident && TREE_CODE (ident) == TYPE_DECL && DECL_ORIGINAL_TYPE (ident))
ident = OBJC_TYPE_NAME (DECL_ORIGINAL_TYPE (ident));
@@ -3453,9 +3457,12 @@ objc_is_class_name (tree ident)
tree
objc_is_id (tree type)
{
- if (type && TREE_CODE (type) == IDENTIFIER_NODE
- && identifier_global_value (type))
- type = identifier_global_value (type);
+ if (type && TREE_CODE (type) == IDENTIFIER_NODE)
+ {
+ tree t = identifier_global_value (type);
+ if (t)
+ type = t;
+ }
if (type && TREE_CODE (type) == TYPE_DECL)
type = TREE_TYPE (type);
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog (revision 172239)
+++ gcc/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2011-04-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * c-parser.c (c_lex_one_token): Rewritten conditional used when
+ compiling Objective-C to be more efficient.
+
2011-04-09 Anatoly Sokolov <aesok@post.ru>
* expr.c (expand_expr_real_1): Use add_to_hard_reg_set function
Index: gcc/c-parser.c
===================================================================
--- gcc/c-parser.c (revision 172239)
+++ gcc/c-parser.c (working copy)
@@ -334,8 +334,7 @@ c_lex_one_token (c_parser *parser, c_token *token)
variables and typedefs, and hence are shadowed by local
declarations. */
if (objc_interface_decl
- && (global_bindings_p ()
- || (!objc_force_identifier && !decl)))
+ && (!objc_force_identifier || global_bindings_p ()))
{
token->value = objc_interface_decl;
token->id_kind = C_ID_CLASSNAME;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ObjC: some minor optimizations
2011-04-11 17:09 ObjC: some minor optimizations Nicola Pero
@ 2011-04-11 22:07 ` Mike Stump
0 siblings, 0 replies; 2+ messages in thread
From: Mike Stump @ 2011-04-11 22:07 UTC (permalink / raw)
To: Nicola Pero; +Cc: gcc-patches
On Apr 11, 2011, at 10:09 AM, Nicola Pero wrote:
> This patch removes some very minor inefficiencies in the ObjC compiler code.
> Ok to commit ?
Ok. I do wonder if namespaces and Objective-C work well together...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-11 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-11 17:09 ObjC: some minor optimizations Nicola Pero
2011-04-11 22:07 ` Mike Stump
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).