[tree-ssa] Gimplifying Java
Andrew MacLeod
amacleod@redhat.com
Thu Jun 12 13:46:00 GMT 2003
On Thu, 2003-06-12 at 09:05, Jeff Sturm wrote:
> On 11 Jun 2003, Andrew MacLeod wrote:
> > Yes, a testcase would be most excellent.
>
> You'll need a patched gcj, I don't have a C/C++ example.
>
Give this a quick try first. I quickly cobbled it together, Im not sure
if the diagnostic is in the right place for java or not, but I added
support for SSAA_NAMe in debug output format %d, and now when there is a
live on entry variable that also has a defintion, or a live-on-entry
variable which is not a parameter, it spits out a warning telling you
what the variable is.
Try it and take a look at what, if anything, it says your variable is,
and check the code coming out of the .dce pass to see what, if anything,
appears to be wrong.
Andrew
Index: c-objc-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-objc-common.c,v
retrieving revision 1.14.2.13
diff -c -p -r1.14.2.13 c-objc-common.c
*** c-objc-common.c 7 May 2003 13:27:33 -0000 1.14.2.13
--- c-objc-common.c 12 Jun 2003 13:41:41 -0000
*************** c_tree_printer (buffer, text)
*** 442,451 ****
case 'F':
case 'T':
{
! const char *n = DECL_NAME (t)
! ? (*lang_hooks.decl_printable_name) (t, 2)
! : "({anonymous})";
! output_add_string (buffer, n);
}
return true;
--- 442,459 ----
case 'F':
case 'T':
{
! const char *n;
! if (TREE_CODE (t) == SSA_NAME)
! {
! dump_generic_node (buffer, t, 0, 2);
! }
! else
! {
! n = DECL_NAME (t)
! ? (*lang_hooks.decl_printable_name) (t, 2)
! : "({anonymous})";
! output_add_string (buffer, n);
! }
}
return true;
Index: tree-ssa-live.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-live.c,v
retrieving revision 1.1.2.7
diff -c -p -r1.1.2.7 tree-ssa-live.c
*** tree-ssa-live.c 11 Jun 2003 12:41:21 -0000 1.1.2.7
--- tree-ssa-live.c 12 Jun 2003 13:41:41 -0000
*************** Boston, MA 02111-1307, USA. */
*** 38,43 ****
--- 38,44 ----
#include "hashtab.h"
#include "tree-dump.h"
#include "tree-ssa-live.h"
+ #include "errors.h"
extern unsigned long next_ssa_version;
*************** calculate_live_on_entry (var_map map)
*** 545,550 ****
--- 546,573 ----
live_worklist (live, stack, i);
});
+ #ifdef ENABLE_CHECKING
+ /* Check for live on entry partitions and report those with a DEF in
+ the program. This will typically mean an optimization has done
+ something wrong. */
+ for (i = 0; i < num_var_partitions (map); i++)
+ {
+ if (TEST_BIT (live_entry_blocks (live, i), 0))
+ {
+ var = partition_to_var (map, i);
+ if (!IS_EMPTY_STMT (SSA_NAME_DEF_STMT (var)))
+ warning ("'%D' is defined, but is also live on entry.", var);
+ else
+ {
+ /* Only PARM_DECLS should be live on entry right now. */
+ if (TREE_CODE (SSA_NAME_VAR (var)) != PARM_DECL)
+ warning ("'%D' is not a PARM_DECL, but is live on entry.", var);
+
+ }
+ }
+ }
+
+ #endif
return live;
}
More information about the Java-patches
mailing list