pike.git/
src/
peep.c
Branch:
Tag:
Non-build tags
All tags
No tags
2000-11-25
2000-11-25 16:54:46 by Henrik Grubbström (Grubba) <grubba@grubba.org>
b95670a226cd9ba68baa844ffb2531edfa1abd16 (
87
lines) (+
51
/-
36
)
[
Show
|
Annotate
]
Branch:
7.9
Added FIXME.
Prepared for inlining of do_optimize() by mkpeep.pike.
Rev: src/peep.c:1.38
15:
#include "bignum.h" #include "opcodes.h"
-
RCSID("$Id: peep.c,v 1.
37
2000/
09
/
22
12
:54:
10
grubba Exp $");
+
RCSID("$Id: peep.c,v 1.
38
2000/
11
/
25
16
:54:
46
grubba Exp $");
struct p_instr_s {
561:
fatal("Popping out of instructions.\n"); #endif
+
/* FIXME: It looks like the fifo could be optimized.
+
* /grubba 2000-11-21 (in Versailles)
+
*/
+
p=(p_instr *)low_make_buf_space(0, &instrbuf); p-=fifo_len; for(e=0;e<d;e++) free_string(p[e].file);
572:
eye+=n; }
+
#define DO_OPTIMIZATION_PREQUEL(topop) do { \
+
struct pike_string *cf; \
+
INT32 cl=instr(0)->line; \
+
\
+
DO_IF_DEBUG( \
+
if(a_flag>5) \
+
{ \
+
int e; \
+
fprintf(stderr,"PEEP at %d:",cl); \
+
for(e=0;e<topop;e++) \
+
{ \
+
fprintf(stderr," "); \
+
dump_instr(instr(e)); \
+
} \
+
fprintf(stderr," => "); \
+
} \
+
) \
+
\
+
copy_shared_string(cf,instr(0)->file); \
+
pop_n_opcodes(topop)
-
+
#define DO_OPTIMIZATION_POSTQUEL(q) \
+
fifo_len+=q; \
+
free_string(cf); \
+
debug(); \
+
\
+
DO_IF_DEBUG( \
+
if(a_flag>5) \
+
{ \
+
int e; \
+
for(e=0;e<q;e++) \
+
{ \
+
fprintf(stderr," "); \
+
dump_instr(instr(e)); \
+
} \
+
fprintf(stderr,"\n"); \
+
} \
+
) \
+
\
+
fifo_len += q + 3; \
+
} while(0)
+
+
static void do_optimization(int topop, ...) { va_list arglist;
-
struct pike_string *cf;
+
int q=-1;
-
INT32 cl=instr(0)->line;
+
-
#ifdef
PIKE_DEBUG
-
if(a
_
flag>5)
-
{
-
int e;
-
fprintf
(
stderr,"PEEP at %d:",cl);
-
for(e=0;e<
topop
;e++
)
-
{
-
fprintf(stderr," ")
;
-
dump_instr(instr(e));
-
}
-
fprintf(stderr," => ");
-
}
-
#endif
+
DO
_
OPTIMIZATION_PREQUEL
(topop);
-
copy_shared_string(cf,instr(0)->file);
-
pop_n_opcodes(topop);
+
va_start(arglist, topop); while(1)
631:
} va_end(arglist);
-
fifo_len+=q;
-
free_string(cf);
-
debug();
+
-
#ifdef
PIKE_DEBUG
-
if(a
_
flag>5)
-
{
-
int e;
-
for
(
e=0;e<
q
;e++
)
-
{
-
fprintf(stderr," ")
;
-
dump_instr(instr(e));
+
DO
_
OPTIMIZATION_POSTQUEL
(q);
}
-
fprintf(stderr,"\n");
-
}
-
#endif
+
-
fifo_len+=q + 3;
-
}
+
-
+
static void asm_opt(void) { #ifdef PIKE_DEBUG