Author: coke
Date: Wed Aug 20 18:45:51 2008
New Revision: 30417
Modified:
trunk/compilers/imcc/cfg.c
trunk/compilers/imcc/optimizer.c
trunk/compilers/imcc/reg_alloc.c
trunk/compilers/imcc/unit.h
Log:
[imcc] [cage] We can't have a negative number of basic blocks in an IMCC unit.
Switch from int to unsigned int for this struct element. Eliminate all build
warnings related to the signed/unsigned comparison of this element.
Inspired by signed/unsigned warnings when it was the other way.
Modified: trunk/compilers/imcc/cfg.c
==============================================================================
--- trunk/compilers/imcc/cfg.c (original)
+++ trunk/compilers/imcc/cfg.c Wed Aug 20 18:45:51 2008
@@ -354,7 +354,8 @@
build_cfg(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
Basic_block *last = NULL;
- int i, changes;
+ unsigned int i;
+ int changes;
IMCC_info(interp, 2, "build_cfg\n");
@@ -394,7 +395,7 @@
* s. #25948
*/
if (!bb->pred_list) {
- int j;
+ unsigned int j;
for (j = i; j < unit->n_basic_blocks; j++) {
Basic_block * const b_bsr = unit->bb_list[j];
@@ -456,7 +457,7 @@
/* Decouple unreachable blocks (not the first block, with no predecessors)
* from the CFG */
do {
- int i;
+ unsigned int i;
changes = 0;
for (i = 1; i < unit->n_basic_blocks; i++) {
@@ -732,7 +733,7 @@
static void
analyse_life_symbol(ARGIN(const IMC_Unit *unit), ARGMOD(SymReg* r))
{
- int i;
+ unsigned int i;
#if IMC_TRACE_HIGH
fprintf(stderr, "cfg.c: analyse_life_symbol(%s)\n", r->name);
@@ -798,7 +799,7 @@
fprintf(stderr, "free_life_into(%s)\n", r->name);
#endif
if (r->life_info) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++) {
mem_sys_free(r->life_info[i]);
@@ -1167,7 +1168,7 @@
free_dominators(ARGMOD(IMC_Unit *unit))
{
if (unit->dominators) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++) {
set_free(unit->dominators[i]);
@@ -1194,7 +1195,7 @@
free_dominance_frontiers(ARGMOD(IMC_Unit *unit))
{
if (unit->dominance_frontiers) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++) {
set_free(unit->dominance_frontiers[i]);
@@ -1223,7 +1224,8 @@
Loop_info *li;
Loop_info **loop_info = unit->loop_info;
int n_loops = (int)unit->n_loops;
- int i, j, changed;
+ int i, k, changed;
+ unsigned int j;
for (i = 0; i < n_loops; i++) {
loop_info[i]->size = 0;
@@ -1263,22 +1265,22 @@
last = j;
}
- for (j = i + 1; j < n_loops; j++) {
+ for (k = i + 1; k < n_loops; k++) {
if (set_contains(loop_info[i]->loop, first)
&& !set_contains(loop_info[i]->loop, last)) {
IMCC_debug(interp, DEBUG_CFG, "sort_loops",
"loop %d contains first but not"
- "last of outer loop %d\n", j, i);
+ "last of outer loop %d\n", k, i);
}
if (set_contains(loop_info[i]->loop, last)
&& !set_contains(loop_info[i]->loop, first)) {
IMCC_debug(interp, DEBUG_CFG, "sort_loops",
"loop %d contains last but not"
- "first of outer loop %d\n", j, i);
+ "first of outer loop %d\n", k, i);
}
- loop_info[j]->depth = loop_info[i]->depth + 1;
+ loop_info[k]->depth = loop_info[i]->depth + 1;
}
}
}
@@ -1298,7 +1300,7 @@
void
find_loops(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i;
+ unsigned int i;
IMCC_info(interp, 2, "find_loops\n");
@@ -1381,7 +1383,8 @@
Basic_block *footer = e->from;
Basic_block *enter = 0;
- int i, n_loops;
+ unsigned int i;
+ int n_loops;
/* look from where loop was entered */
for (i = 0, edge=header->pred_list; edge; edge=edge->pred_next)
@@ -1540,7 +1543,7 @@
clear_basic_blocks(ARGMOD(IMC_Unit *unit))
{
if (unit->bb_list) {
- int i;
+ unsigned int i;
for (i = 0; i < unit->n_basic_blocks; i++)
mem_sys_free(unit->bb_list[i]);
Modified: trunk/compilers/imcc/optimizer.c
==============================================================================
--- trunk/compilers/imcc/optimizer.c (original)
+++ trunk/compilers/imcc/optimizer.c Wed Aug 20 18:45:51 2008
@@ -1154,7 +1154,7 @@
static int
branch_reorg(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i;
+ unsigned int i;
int changed = 0;
IMCC_info(interp, 2, "\tbranch_reorg\n");
@@ -1394,7 +1394,8 @@
static int
unused_label(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i, used;
+ unsigned int i;
+ int used;
int changed = 0;
IMCC_info(interp, 2, "\tunused_label\n");
@@ -1465,7 +1466,7 @@
static int
dead_code_remove(PARROT_INTERP, ARGMOD(IMC_Unit *unit))
{
- int i;
+ unsigned int i;
int changed = 0;
Instruction *ins, *last;
Modified: trunk/compilers/imcc/reg_alloc.c
==============================================================================
--- trunk/compilers/imcc/reg_alloc.c (original)
+++ trunk/compilers/imcc/reg_alloc.c Wed Aug 20 18:45:51 2008
@@ -835,7 +835,7 @@
interferes(PARROT_INTERP, ARGIN(const IMC_Unit *unit),
ARGIN(const SymReg *r0), ARGIN(const SymReg *r1))
{
- int i;
+ unsigned int i;
/* Registers don't interfere with themselves */
if (r0 == r1)
Modified: trunk/compilers/imcc/unit.h
==============================================================================
--- trunk/compilers/imcc/unit.h (original)
+++ trunk/compilers/imcc/unit.h Wed Aug 20 18:45:51 2008
@@ -38,7 +38,7 @@
Instruction *last_ins;
SymHash hash;
int bb_list_size;
- int n_basic_blocks;
+ unsigned int n_basic_blocks;
Basic_block **bb_list;
Set **dominators;
int *idoms;