cvsuser 03/11/03 17:11:25
Modified: imcc debug.c pbc.c sets.c
Log:
Cleanup some code formatting.
Revision Changes Path
1.29 +32 -12 parrot/imcc/debug.c
Index: debug.c
===================================================================
RCS file: /cvs/public/parrot/imcc/debug.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -r1.28 -r1.29
--- debug.c 23 Oct 2003 17:02:49 -0000 1.28
+++ debug.c 4 Nov 2003 01:11:25 -0000 1.29
@@ -7,7 +7,8 @@
#include "imc.h"
-void fatal(int code, const char *func, const char *fmt, ...)
+void
+fatal(int code, const char *func, const char *fmt, ...)
{
va_list ap;
@@ -19,7 +20,8 @@
}
-void fataly(int code, const char *file, int lin, const char *fmt, ...)
+void
+fataly(int code, const char *file, int lin, const char *fmt, ...)
{
va_list ap;
@@ -33,7 +35,8 @@
}
-void warning(Parrot_Interp interpreter, const char *func, const char *fmt, ...)
+void
+warning(Parrot_Interp interpreter, const char *func, const char *fmt, ...)
{
va_list ap;
if (IMCC_INFO(interpreter)->imcc_warn)
@@ -45,7 +48,8 @@
va_end(ap);
}
-void info(Parrot_Interp interpreter, int level, const char *fmt, ...)
+void
+info(Parrot_Interp interpreter, int level, const char *fmt, ...)
{
va_list ap;
@@ -69,7 +73,9 @@
va_end(ap);
}
-void dump_instructions(Parrot_Interp interpreter) {
+void
+dump_instructions(Parrot_Interp interpreter)
+{
Instruction *ins;
Basic_block *bb;
int pc;
@@ -96,7 +102,9 @@
fprintf(stderr, "\n");
}
-void dump_cfg(Parrot_Interp interpreter) {
+void
+dump_cfg(Parrot_Interp interpreter)
+{
int i;
Basic_block *bb;
Edge *e;
@@ -119,7 +127,9 @@
}
-void dump_loops(Parrot_Interp interpreter) {
+void
+dump_loops(Parrot_Interp interpreter)
+{
int i, j;
Set *loop;
Loop_info ** loop_info = IMCC_INFO(interpreter)->loop_info;
@@ -159,7 +169,9 @@
fprintf(stderr, "\n");
}
-void dump_symreg(Parrot_Interp interpreter) {
+void
+dump_symreg(Parrot_Interp interpreter)
+{
int i;
SymReg** reglist = IMCC_INFO(interpreter)->reglist;
@@ -193,7 +205,9 @@
}
-void dump_liveness_status(Parrot_Interp interpreter) {
+void
+dump_liveness_status(Parrot_Interp interpreter)
+{
int i;
SymReg** reglist = IMCC_INFO(interpreter)->reglist;
@@ -208,7 +222,9 @@
}
-void dump_liveness_status_var(Parrot_Interp interpreter, SymReg* r) {
+void
+dump_liveness_status_var(Parrot_Interp interpreter, SymReg* r)
+{
int i;
Life_range *l;
@@ -245,7 +261,9 @@
fprintf(stderr, "\n");
}
-void dump_interference_graph(Parrot_Interp interpreter) {
+void
+dump_interference_graph(Parrot_Interp interpreter)
+{
int x, y, cnt;
SymReg *r;
SymReg** reglist = IMCC_INFO(interpreter)->reglist;
@@ -274,7 +292,9 @@
fprintf(stderr, "\n");
}
-void dump_dominators(Parrot_Interp interpreter) {
+void
+dump_dominators(Parrot_Interp interpreter)
+{
int i, j;
fprintf(stderr, "\nDumping the Dominators Tree:"
1.55 +32 -15 parrot/imcc/pbc.c
Index: pbc.c
===================================================================
RCS file: /cvs/public/parrot/imcc/pbc.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -w -r1.54 -r1.55
--- pbc.c 23 Oct 2003 17:02:49 -0000 1.54
+++ pbc.c 4 Nov 2003 01:11:25 -0000 1.55
@@ -72,7 +72,8 @@
static void imcc_globals_destroy(int ex, void *param);
-static void imcc_globals_destroy(int ex, void *param)
+static void
+imcc_globals_destroy(int ex, void *param)
{
struct cs_t *cs, *prev_cs;
struct subs *s, *prev_s;
@@ -136,7 +137,9 @@
return cur_cs;
}
-int e_pbc_open(void *param) {
+int
+e_pbc_open(void *param)
+{
struct cs_t *cs;
struct Parrot_Interp *interpreter = (struct Parrot_Interp *)param;
@@ -253,13 +256,15 @@
}
-static void store_sub_size(size_t size, size_t ins_line)
+static void
+store_sub_size(size_t size, size_t ins_line)
{
globals.cs->subs->size = size;
globals.cs->subs->ins_line = ins_line;
}
-static void store_label(SymReg * r, int pc)
+static void
+store_label(SymReg * r, int pc)
{
SymReg * label;
label = _mk_address(globals.cs->subs->labels, str_dup(r->name),
@@ -267,7 +272,8 @@
label->color = pc;
}
-static void store_bsr(SymReg * r, int pc, int offset)
+static void
+store_bsr(SymReg * r, int pc, int offset)
{
SymReg * bsr;
bsr = _mk_address(globals.cs->subs->bsrs, str_dup(r->name), U_add_all);
@@ -275,7 +281,8 @@
bsr->score = offset; /* bsr = 1, set_addr I,x = 2, newsub = 3 */
}
-static void store_key_const(char * str, int idx)
+static void
+store_key_const(char * str, int idx)
{
SymReg * c;
c = _mk_const(globals.cs->key_consts, str_dup(str), 0);
@@ -417,7 +424,8 @@
/* get a globale label, return the pc (absolute) */
-static SymReg * find_global_label(char *name, int *pc)
+static SymReg *
+find_global_label(char *name, int *pc)
{
SymReg * r;
struct subs *s;
@@ -433,7 +441,8 @@
}
/* fix global branches */
-void fixup_bsrs(struct Parrot_Interp *interpreter)
+void
+fixup_bsrs(struct Parrot_Interp *interpreter)
{
int i, pc, addr;
SymReg * bsr, *lab;
@@ -466,7 +475,8 @@
/*
* the string can't grow, so its done in place
*/
-static int unescape(char *string)
+static int
+unescape(char *string)
{
char *start, *p;
char hexdigits[] = "0123456789abcdef";
@@ -530,7 +540,8 @@
/* add constant string to constant_table */
static int
-add_const_str(struct Parrot_Interp *interpreter, char *str) {
+add_const_str(struct Parrot_Interp *interpreter, char *str)
+{
int k, l;
char *o;
char *buf = o = str_dup(str);
@@ -565,7 +576,8 @@
}
static int
-add_const_num(struct Parrot_Interp *interpreter, char *buf) {
+add_const_num(struct Parrot_Interp *interpreter, char *buf)
+{
int k;
k = PDB_extend_const_table(interpreter);
@@ -579,7 +591,8 @@
static int
add_const_pmc_sub(struct Parrot_Interp *interpreter, SymReg *r,
- int offs, int len) {
+ int offs, int len)
+{
int k;
char buf[256];
opcode_t *rc;
@@ -615,7 +628,8 @@
/* add constant key to constant_table */
static int
add_const_key(struct Parrot_Interp *interpreter, opcode_t key[],
- int size, char *s_key) {
+ int size, char *s_key)
+{
int k;
SymReg *r;
struct PackFile_Constant *pfc;
@@ -724,7 +738,8 @@
return k;
}
-static void add_1_const(struct Parrot_Interp *interpreter, SymReg *r)
+static void
+add_1_const(struct Parrot_Interp *interpreter, SymReg *r)
{
if (r->color >= 0)
return;
@@ -919,7 +934,9 @@
return ok;
}
-int e_pbc_close(void *param){
+int
+e_pbc_close(void *param)
+{
struct Parrot_Interp *interpreter = (struct Parrot_Interp *)param;
fixup_bsrs(interpreter);
1.7 +66 -49 parrot/imcc/sets.c
Index: sets.c
===================================================================
RCS file: /cvs/public/parrot/imcc/sets.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- sets.c 23 Oct 2003 17:02:49 -0000 1.6
+++ sets.c 4 Nov 2003 01:11:25 -0000 1.7
@@ -1,7 +1,9 @@
#include "imc.h"
-Set* set_make (int length) {
+Set*
+set_make (int length)
+{
Set *s = malloc(sizeof(Set));
if (!s)
fatal(1, "set_make", "Out of mem\n");
@@ -13,7 +15,9 @@
return s;
}
-Set* set_make_full (int length) {
+Set*
+set_make_full (int length)
+{
Set *s = set_make(length);
int i;
int bytes = length/8;
@@ -28,17 +32,22 @@
return s;
}
-void set_free (Set *s) {
+void
+set_free (Set *s)
+{
free (s->bmp);
free (s);
}
-void set_clear(Set *s)
+void
+set_clear(Set *s)
{
memset(s->bmp, 0, s->length/8 +1);
}
-Set* set_copy (Set *s1) {
+Set*
+set_copy (Set *s1)
+{
Set *s = set_make(s1->length);
memcpy(s->bmp, s1->bmp, s->length/8 + 1);
@@ -46,8 +55,9 @@
}
-int set_equal (Set *s1, Set *s2) {
-
+int
+set_equal (Set *s1, Set *s2)
+{
int mask;
int bytes = s1->length/8;
if (s1->length != s2->length) {
@@ -65,11 +75,15 @@
return 1;
}
-void set_add (Set *s, int element) {
+void
+set_add(Set *s, int element)
+{
s->bmp[element >> 3] |= (1 << (element & 7));
}
-int set_contains(Set *s, int element) {
+int
+set_contains(Set *s, int element)
+{
#ifdef __LCC__
/* workaround for another lcc bug.. */
int tmp = (1 << (element & 7));
@@ -79,14 +93,14 @@
#endif
}
-Set * set_union(Set *s1, Set *s2) {
+Set *
+set_union(Set *s1, Set *s2)
+{
int i;
-
Set *s = set_make(s1->length);
if (s1->length != s2->length) {
fatal(1, "set_union", "Sets don't have the same length\n");
-
}
for (i=0; i< (s1->length/8) + 1; i++) {
s->bmp[i] = s1->bmp[i] | s2->bmp[i];
@@ -97,14 +111,14 @@
-Set * set_intersec(Set *s1, Set *s2) {
+Set *
+set_intersec(Set *s1, Set *s2)
+{
int i;
-
Set *s = set_make(s1->length);
if (s1->length != s2->length) {
fatal(1, "set_intersec", "Sets don't have the same length\n");
-
}
for (i=0; i< (s1->length/8) + 1; i++) {
s->bmp[i] = s1->bmp[i] & s2->bmp[i];
@@ -113,7 +127,9 @@
return s;
}
-void set_intersec_inplace(Set *s1, Set *s2) {
+void
+set_intersec_inplace(Set *s1, Set *s2)
+{
int i;
if (s1->length != s2->length) {
@@ -124,6 +140,7 @@
s1->bmp[i] &= s2->bmp[i];
}
}
+
/*
* Local variables:
* c-indentation-style: bsd