* [lto][patch] Remove a use of DECL_LANG_SPECIFIC
@ 2008-09-26 11:18 Rafael Espindola
2008-09-26 12:38 ` Diego Novillo
0 siblings, 1 reply; 2+ messages in thread
From: Rafael Espindola @ 2008-09-26 11:18 UTC (permalink / raw)
To: GCC Patches; +Cc: Diego Novillo
[-- Attachment #1: Type: text/plain, Size: 605 bytes --]
I would like to use DECL_LANG_SPECIFIC to store the resolution
provided by the linker. I can't do it now because the streamer uses
it.
This patch removes the streamer use of DECL_LANG_SPECIFIC from the streamer.
Bootstrapped and tested on linux x86-64.
2008-09-26 Rafael Espindola <espindola@google.com>
* lto-function-in.c (vec_tree_ptr, lto_fixups): New.
(global_vector_fixup, input_tree): Use lto_fixups instead of
DECL_LANG_SPECIFIC.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: decl_lang_specific.patch --]
[-- Type: text/x-diff; name=decl_lang_specific.patch, Size: 2845 bytes --]
diff --git a/gcc/lto-function-in.c b/gcc/lto-function-in.c
index 78018ab..8d1d53f 100644
--- a/gcc/lto-function-in.c
+++ b/gcc/lto-function-in.c
@@ -64,6 +64,12 @@ typedef tree * tree_ptr;
DEF_VEC_P (tree_ptr);
DEF_VEC_ALLOC_P (tree_ptr, heap);
+typedef VEC(tree_ptr, heap) * vec_tree_ptr;
+DEF_VEC_P (vec_tree_ptr);
+DEF_VEC_ALLOC_P (vec_tree_ptr, heap);
+
+static VEC (vec_tree_ptr, heap) *lto_fixups;
+
static enum tree_code tag_to_expr[LTO_tree_last_tag];
/* The number of flags that are defined for each tree code. */
@@ -2715,7 +2721,11 @@ global_vector_fixup (struct data_in *data_in, unsigned index, tree node)
gcc_assert (DECL_P (old_node));
gcc_assert (TREE_VISITED (old_node));
- fixups = (VEC(tree_ptr, heap) *) DECL_LANG_SPECIFIC (old_node);
+ if (index < VEC_length (vec_tree_ptr, lto_fixups))
+ fixups = VEC_index (vec_tree_ptr, lto_fixups, index);
+ else
+ fixups = NULL;
+
if (fixups)
{
unsigned ix;
@@ -2730,7 +2740,7 @@ global_vector_fixup (struct data_in *data_in, unsigned index, tree node)
}
VEC_free (tree_ptr, heap, fixups);
- DECL_LANG_SPECIFIC (old_node) = (struct lang_decl *) NULL;
+ VEC_replace (vec_tree_ptr, lto_fixups, index, NULL);
}
TREE_VISITED (old_node) = false;
@@ -4034,28 +4044,30 @@ input_tree (tree *slot, struct lto_input_block *ib, struct data_in *data_in)
by another in global_vector_fixup, and references to it must
be backpatched. Add the address of the slot that we just
read into a vector of locations to backpatch associated with
- this object. The vector of locations to backpatch is stored
- in the otherwise unused DECL_LANG_SPECIFIC slot. */
+ this object. */
if (TREE_VISITED (result))
{
VEC(tree_ptr, heap) *fixups;
- /* At present, only declaration nodes are backpatched,
- and the use of the DECL_LANG_SPECIFIC slot relies on this. */
+ /* At present, only declaration nodes are backpatched. */
gcc_assert (DECL_P (result));
- fixups = (VEC(tree_ptr, heap) *) DECL_LANG_SPECIFIC (result);
+ if(index >= VEC_length (vec_tree_ptr, lto_fixups))
+ VEC_safe_grow_cleared (vec_tree_ptr, heap, lto_fixups, index + 1);
+
+ fixups = VEC_index (vec_tree_ptr, lto_fixups, index);
+
if (!fixups)
{
/* FIXME lto: It likely makes sense to preallocate a
small number of vector elements greater than one. */
fixups = VEC_alloc (tree_ptr, heap, 1);
- DECL_LANG_SPECIFIC (result) = (struct lang_decl *) fixups;
+ VEC_replace (vec_tree_ptr, lto_fixups, index, fixups);
}
VEC_safe_push (tree_ptr, heap, fixups, slot);
/* Handle the case that the vector was resized. */
- DECL_LANG_SPECIFIC (result) = (struct lang_decl *) fixups;
+ VEC_replace (vec_tree_ptr, lto_fixups, index, fixups);
}
}
else
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [lto][patch] Remove a use of DECL_LANG_SPECIFIC
2008-09-26 11:18 [lto][patch] Remove a use of DECL_LANG_SPECIFIC Rafael Espindola
@ 2008-09-26 12:38 ` Diego Novillo
0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2008-09-26 12:38 UTC (permalink / raw)
To: Rafael Espindola; +Cc: GCC Patches
On Fri, Sep 26, 2008 at 05:58, Rafael Espindola <espindola@google.com> wrote:
> 2008-09-26 Rafael Espindola <espindola@google.com>
>
> * lto-function-in.c (vec_tree_ptr, lto_fixups): New.
> (global_vector_fixup, input_tree): Use lto_fixups instead of
> DECL_LANG_SPECIFIC.
OK.
Diego.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-26 10:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-26 11:18 [lto][patch] Remove a use of DECL_LANG_SPECIFIC Rafael Espindola
2008-09-26 12:38 ` Diego Novillo
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).