Author: kjs
Date: Sun Dec 14 07:25:41 2008
New Revision: 33881
Modified:
trunk/compilers/pirc/new/pircompunit.c
trunk/compilers/pirc/new/pircompunit.h
trunk/compilers/pirc/new/pirregalloc.c
Log:
[pirc] update register usage in sub struct after doing register optimization.
Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c (original)
+++ trunk/compilers/pirc/new/pircompunit.c Sun Dec 14 07:25:41 2008
@@ -2394,6 +2394,24 @@
linear_scan_register_allocation(lexer->lsr);
}
+/*
+
+=item C<void
+update_sub_register_usage(lexer_state * const lexer, unsigned reg_usage[4])>
+
+Update register usage for the current subroutine with the register usage
+information in C<reg_usage>.
+
+=cut
+
+*/
+void
+update_sub_register_usage(lexer_state * const lexer, unsigned reg_usage[4]) {
+ int i;
+ for (i = 0; i < 4; ++i)
+ CURRENT_SUB(lexer)->regs_used[i] = reg_usage[i];
+}
+
/*
Modified: trunk/compilers/pirc/new/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.h (original)
+++ trunk/compilers/pirc/new/pircompunit.h Sun Dec 14 07:25:41 2008
@@ -451,6 +451,8 @@
void set_op_labelflag(struct lexer_state * const lexer, int flag);
void convert_inv_to_instr(struct lexer_state * const lexer, invocation * const
inv);
+void update_sub_register_usage(struct lexer_state * const lexer, unsigned
reg_usage[4]);
+
void panic(struct lexer_state * lexer, char const * const message);
#endif /* PARROT_PIR_PIRCOMPUNIT_H_GUARD */
Modified: trunk/compilers/pirc/new/pirregalloc.c
==============================================================================
--- trunk/compilers/pirc/new/pirregalloc.c (original)
+++ trunk/compilers/pirc/new/pirregalloc.c Sun Dec 14 07:25:41 2008
@@ -457,6 +457,7 @@
lsr->intervals[type] = NULL;
}
+ update_sub_register_usage(lsr->lexer, lsr->r);
}