projects
/
platform
/
upstream
/
orc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3dbaeb7
)
implement constant folding
author
David Schleef
<ds@schleef.org>
Fri, 3 Sep 2010 19:29:36 +0000
(12:29 -0700)
committer
David Schleef
<ds@schleef.org>
Fri, 3 Sep 2010 19:29:36 +0000
(12:29 -0700)
orc/orcprogram.c
patch
|
blob
|
history
diff --git
a/orc/orcprogram.c
b/orc/orcprogram.c
index
3cfe45b
..
287b8d6
100644
(file)
--- a/
orc/orcprogram.c
+++ b/
orc/orcprogram.c
@@
-400,6
+400,7
@@
orc_program_add_constant_str (OrcProgram *program, int size,
char *end;
int val_i;
double val_d;
+ int j;
i = ORC_VAR_C1 + program->n_const_vars;
@@
-422,6
+423,12
@@
orc_program_add_constant_str (OrcProgram *program, int size,
}
}
+ for(j=0;j<program->n_const_vars;j++){
+ if (program->vars[ORC_VAR_C1 + j].value.i == program->vars[i].value.i) {
+ return ORC_VAR_C1 + j;
+ }
+ }
+
program->vars[i].vartype = ORC_VAR_TYPE_CONST;
program->vars[i].size = size;
program->vars[i].name = strdup(name);