projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use tv_t.h instead of tv.h
[libfirm]
/
ir
/
ir
/
irreflect.c
diff --git
a/ir/ir/irreflect.c
b/ir/ir/irreflect.c
index
b88aa3c
..
075430b
100644
(file)
--- a/
ir/ir/irreflect.c
+++ b/
ir/ir/irreflect.c
@@
-20,9
+20,7
@@
# include <strings.h>
#endif
# include <strings.h>
#endif
-#define obstack_chunk_alloc malloc
-#define obstack_chunk_free free
-#include <obstack.h>
+#include "obst.h"
#include "irmode.h"
#include "irreflect.h"
#include "irmode.h"
#include "irreflect.h"
@@
-68,7
+66,7
@@
typedef struct {
const char *name;
bool commutative;
int sig_count;
const char *name;
bool commutative;
int sig_count;
-
const
rflct_arg_t *sigs[MAX_SIG_COUNT];
+ rflct_arg_t *sigs[MAX_SIG_COUNT];
} rflct_opcode_t;
static struct obstack obst;
} rflct_opcode_t;
static struct obstack obst;
@@
-81,9
+79,7
@@
static INLINE void assure_opcode_capacity(int opcode)
{
if(opcode >= opcodes_size) {
int new_size = 2 * opcode;
{
if(opcode >= opcodes_size) {
int new_size = 2 * opcode;
- rflct_opcode_t **new_opcodes = malloc(sizeof(*new_opcodes) * new_size);
-
- memset(new_opcodes, 0, sizeof(*new_opcodes) * new_size);
+ rflct_opcode_t **new_opcodes = xcalloc(new_size, sizeof(new_opcodes[0]));
if(opcodes != NULL) {
memcpy(new_opcodes, opcodes, sizeof(*opcodes) * opcodes_size);
if(opcodes != NULL) {
memcpy(new_opcodes, opcodes, sizeof(*opcodes) * opcodes_size);
@@
-96,7
+92,10
@@
static INLINE void assure_opcode_capacity(int opcode)
}
}
+#if 0
#define OPCODES_COUNT (sizeof(opcodes) / sizeof(opcodes[0]))
#define OPCODES_COUNT (sizeof(opcodes) / sizeof(opcodes[0]))
+#endif
+#define OPCODES_COUNT opcodes_size
rflct_mode_class_t rflct_get_mode_class(const ir_mode *mode) {
rflct_mode_class_t rflct_get_mode_class(const ir_mode *mode) {
@@
-175,7
+174,7
@@
const rflct_arg_t *rflct_get_out_args(opcode opc, int sig) {
return GET_ARGS(opc, sig);
}
return GET_ARGS(opc, sig);
}
-int rflct_signature_match(ir_node *irn, int sig) {
+int rflct_signature_match(
const
ir_node *irn, int sig) {
opcode op = get_irn_opcode(irn);
const rflct_arg_t *args = rflct_get_in_args(op, sig);
int dst = 0;
opcode op = get_irn_opcode(irn);
const rflct_arg_t *args = rflct_get_in_args(op, sig);
int dst = 0;
@@
-200,7
+199,7
@@
int rflct_signature_match(ir_node *irn, int sig) {
return dst;
}
return dst;
}
-int rflct_get_signature(ir_node *irn) {
+int rflct_get_signature(
const
ir_node *irn) {
const rflct_opcode_t *opc = GET_OPCODE(get_irn_opcode(irn));
int min_dist = INT_MAX;
int min_sig = INT_MAX;
const rflct_opcode_t *opc = GET_OPCODE(get_irn_opcode(irn));
int min_dist = INT_MAX;
int min_sig = INT_MAX;
@@
-417,7
+416,7
@@
void rflct_new_opcode(opcode opc, const char *name, bool commutative)
bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig)
{
bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig)
{
-
const
rflct_arg_t *args = sig->args;
+ rflct_arg_t *args = sig->args;
rflct_opcode_t *op = opcodes[opc];
int i;
rflct_opcode_t *op = opcodes[opc];
int i;
@@
-437,7
+436,7
@@
bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig)
rflct_sig_t *rflct_signature_allocate(int defs, int uses)
{
rflct_sig_t *rflct_signature_allocate(int defs, int uses)
{
- rflct_sig_t *sig = malloc(sizeof(*sig));
+ rflct_sig_t *sig =
x
malloc(sizeof(*sig));
rflct_arg_t *args =
obstack_alloc(&obst, sizeof(*args) * (defs + uses + 2));
rflct_arg_t *args =
obstack_alloc(&obst, sizeof(*args) * (defs + uses + 2));
@@
-477,6
+476,6
@@
int rflct_signature_set_arg(rflct_sig_t *sig, bool is_use, int num,
}
}
-void init_rflct(void) {
+void
firm_
init_rflct(void) {
init_ops();
}
init_ops();
}