projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed again
[libfirm]
/
ir
/
be
/
ia32
/
ia32_emitter.c
diff --git
a/ir/be/ia32/ia32_emitter.c
b/ir/be/ia32/ia32_emitter.c
index
999317a
..
03907b4
100644
(file)
--- a/
ir/be/ia32/ia32_emitter.c
+++ b/
ir/be/ia32/ia32_emitter.c
@@
-25,6
+25,17
@@
static const arch_env_t *arch_env = NULL;
static const arch_env_t *arch_env = NULL;
+char *ia32_emit_binop(ir_node *irn) {
+ return "R1, R2";
+}
+
+char *ia32_emit_unop(ir_node *irn) {
+ return "R";
+}
+
+char *ia32_emit_am(ir_node *irn) {
+ return "AM";
+}
/*************************************************************
* _ _ __ _ _
/*************************************************************
* _ _ __ _ _
@@
-41,35
+52,24
@@
static const arch_env_t *arch_env = NULL;
* Return node's tarval as string.
*/
const char *node_const_to_str(ir_node *n) {
* Return node's tarval as string.
*/
const char *node_const_to_str(ir_node *n) {
- char *buf;
- tarval *tv = get_ia32_Immop_tarval(n);
+ char *s = get_ia32_cnst(n);
- if (tv) {
- buf = xmalloc(SNPRINTF_BUF_LEN);
- tarval_snprintf(buf, SNPRINTF_BUF_LEN, tv);
- return buf;
- }
- else if (get_ia32_old_ir(n)) {
- return get_sc_name(get_ia32_old_ir(n));
- }
- else
- return "0";
+ if (!s)
+ s = "NULL";
+
+ return s;
}
/**
* Returns node's offset as string.
*/
char *node_offset_to_str(ir_node *n) {
}
/**
* Returns node's offset as string.
*/
char *node_offset_to_str(ir_node *n) {
- char *buf;
- tarval *tv = get_ia32_am_offs(n);
+ char *s = get_ia32_am_offs(n);
- if (tv) {
- buf = xmalloc(SNPRINTF_BUF_LEN);
- tarval_snprintf(buf, SNPRINTF_BUF_LEN, tv);
- return buf;
- }
- else
- return "";
+ if (!s)
+ s = "";
+
+ return s;
}
/* We always pass the ir_node which is a pointer. */
}
/* We always pass the ir_node which is a pointer. */
@@
-642,9
+642,10
@@
void emit_ia32_Call(ir_node *irn, emit_env_t *emit_env) {
ir_node **args = get_Sync_preds_arr(sync);
for (i = 0; i < get_Sync_n_preds(sync); i++) {
ir_node **args = get_Sync_preds_arr(sync);
for (i = 0; i < get_Sync_n_preds(sync); i++) {
- lc_efprintf(env, F, "\tpush %1D\t\t\t\t/* push %+F on stack */\n", args[i], args[i]);
+ ir_node *n = get_irn_n(args[i], 1);
+ lc_efprintf(env, F, "\tpush %1D\t\t\t\t/* push %+F(%+F) on stack */\n", n, args[i], n);
- if (mode_is_
int(get_irn_mode(args[i]
))) {
+ if (mode_is_
float(get_irn_mode(n
))) {
args_size += 4;
}
else {
args_size += 4;
}
else {
@@
-659,10
+660,10
@@
void emit_ia32_Call(ir_node *irn, emit_env_t *emit_env) {
/* We had stack arguments: clear the stack */
fprintf(F, "\tadd %d, ", args_size);
if (emit_env->cg->has_alloca) {
/* We had stack arguments: clear the stack */
fprintf(F, "\tadd %d, ", args_size);
if (emit_env->cg->has_alloca) {
- fprintf(F, "%ebp");
+ fprintf(F, "%
%
ebp");
}
else {
}
else {
- fprintf(F, "%esp");
+ fprintf(F, "%
%
esp");
}
fprintf(F, "\t\t\t\t/* clear stack after call */\n");
}
}
fprintf(F, "\t\t\t\t/* clear stack after call */\n");
}
@@
-735,15
+736,10
@@
void ia32_emit_node(ir_node *irn, void *env) {
#define EMIT(a) if (get_irn_opcode(irn) == iro_##a) { emit_##a(irn, emit_env); return; }
/* generated int emitter functions */
#define EMIT(a) if (get_irn_opcode(irn) == iro_##a) { emit_##a(irn, emit_env); return; }
/* generated int emitter functions */
- IA32_EMIT(Copy);
- IA32_EMIT(Perm);
-
IA32_EMIT(Const);
IA32_EMIT(Add);
IA32_EMIT(Const);
IA32_EMIT(Add);
- IA32_EMIT(Add_i);
IA32_EMIT(Sub);
IA32_EMIT(Sub);
- IA32_EMIT(Sub_i);
IA32_EMIT(Minus);
IA32_EMIT(Inc);
IA32_EMIT(Dec);
IA32_EMIT(Minus);
IA32_EMIT(Inc);
IA32_EMIT(Dec);
@@
-752,30
+748,21
@@
void ia32_emit_node(ir_node *irn, void *env) {
IA32_EMIT(Min);
IA32_EMIT(And);
IA32_EMIT(Min);
IA32_EMIT(And);
- IA32_EMIT(And_i);
IA32_EMIT(Or);
IA32_EMIT(Or);
- IA32_EMIT(Or_i);
IA32_EMIT(Eor);
IA32_EMIT(Eor);
- IA32_EMIT(Eor_i);
IA32_EMIT(Not);
IA32_EMIT(Shl);
IA32_EMIT(Not);
IA32_EMIT(Shl);
- IA32_EMIT(Shl_i);
IA32_EMIT(Shr);
IA32_EMIT(Shr);
- IA32_EMIT(Shr_i);
IA32_EMIT(Shrs);
IA32_EMIT(Shrs);
- IA32_EMIT(Shrs_i);
IA32_EMIT(RotL);
IA32_EMIT(RotL);
- IA32_EMIT(RotL_i);
IA32_EMIT(RotR);
IA32_EMIT(Lea);
IA32_EMIT(RotR);
IA32_EMIT(Lea);
- IA32_EMIT(Lea_i);
IA32_EMIT(Mul);
IA32_EMIT(Mul);
- IA32_EMIT(Mul_i);
- IA32_EMIT(C
ltd
);
+ IA32_EMIT(C
dq
);
IA32_EMIT(DivMod);
IA32_EMIT(Store);
IA32_EMIT(DivMod);
IA32_EMIT(Store);
@@
-786,7
+773,6
@@
void ia32_emit_node(ir_node *irn, void *env) {
IA32_EMIT(fAdd);
IA32_EMIT(fSub);
IA32_EMIT(fAdd);
IA32_EMIT(fSub);
- IA32_EMIT(fMinus);
IA32_EMIT(fMul);
IA32_EMIT(fDiv);
IA32_EMIT(fMul);
IA32_EMIT(fDiv);
@@
-799,11
+785,8
@@
void ia32_emit_node(ir_node *irn, void *env) {
/* other emitter functions */
IA32_EMIT(CondJmp);
/* other emitter functions */
IA32_EMIT(CondJmp);
- IA32_EMIT(CondJmp_i);
IA32_EMIT(SwitchJmp);
IA32_EMIT(Call);
IA32_EMIT(SwitchJmp);
IA32_EMIT(Call);
- IA32_EMIT(Alloca);
- IA32_EMIT(Alloca_i);
EMIT(Jmp);
EMIT(Proj);
EMIT(Jmp);
EMIT(Proj);
@@
-875,6
+858,9
@@
void ia32_gen_routine(FILE *F, ir_graph *irg, const ia32_code_gen_t *cg) {
emit_env.arch_env = cg->arch_env;
emit_env.cg = cg;
emit_env.arch_env = cg->arch_env;
emit_env.cg = cg;
+ /* set the global arch_env (needed by print hooks) */
+ arch_env = cg->arch_env;
+
ia32_emit_start(F, irg);
irg_block_walk_graph(irg, ia32_gen_labels, NULL, &emit_env);
irg_walk_blkwise_graph(irg, NULL, ia32_gen_block, &emit_env);
ia32_emit_start(F, irg);
irg_block_walk_graph(irg, ia32_gen_labels, NULL, &emit_env);
irg_walk_blkwise_graph(irg, NULL, ia32_gen_block, &emit_env);