Commit 9a31e289 authored by Christian Würdig's avatar Christian Würdig
Browse files

made emit more nasm compatible

add new 8bit store node
parent 317e5e57
......@@ -562,6 +562,9 @@ static void transform_to_Store(ia32_transform_env_t *env) {
if (mode_is_float(mode)) {
new_op = new_rd_ia32_fStore(env->dbg, env->irg, env->block, ptr, noreg, val, nomem, mode_T);
}
else if (get_mode_size_bits(mode) == 8) {
new_op = new_rd_ia32_Store8Bit(env->dbg, env->irg, env->block, ptr, noreg, val, nomem, mode_T);
}
else {
new_op = new_rd_ia32_Store(env->dbg, env->irg, env->block, ptr, noreg, val, nomem, mode_T);
}
......@@ -848,8 +851,8 @@ void ia32_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *ab
}
/* set register parameters */
// if (cc & cc_reg_param) {
if (1) {
if (cc & cc_reg_param) {
// if (1) {
/* determine the number of parameters passed via registers */
biggest_n = ia32_get_n_regparam_class(n, modes, &ignore_1, &ignore_2);
......
......@@ -240,7 +240,12 @@ char *ia32_emit_binop(const ir_node *n, ia32_emit_env_t *env) {
/* verify that this function is never called on non-AM supporting operations */
assert(get_ia32_am_support(n) != ia32_am_None && "emit binop expects addressmode support");
#define PRODUCES_RESULT(n) !(is_ia32_St(n) || is_ia32_CondJmp(n) || is_ia32_fCondJmp(n) || is_ia32_SwitchJmp(n))
#define PRODUCES_RESULT(n) \
(!(is_ia32_St(n) || \
is_ia32_Store8Bit(n) || \
is_ia32_CondJmp(n) || \
is_ia32_fCondJmp(n) || \
is_ia32_SwitchJmp(n)))
if (! buf) {
buf = xcalloc(1, SNPRINTF_BUF_LEN);
......@@ -1128,7 +1133,7 @@ static void ia32_emit_func_prolog(FILE *F, ir_graph *irg) {
entity *irg_ent = get_irg_entity(irg);
const char *irg_name = get_entity_name(irg_ent);
// fprintf(F, "\t.text\n");
fprintf(F, "\tsection .text\n");
if (get_entity_visibility(irg_ent) == visibility_external_visible) {
fprintf(F, "global %s\n", irg_name);
}
......@@ -1142,7 +1147,7 @@ static void ia32_emit_func_prolog(FILE *F, ir_graph *irg) {
static void ia32_emit_func_epilog(FILE *F, ir_graph *irg) {
const char *irg_name = get_entity_name(get_irg_entity(irg));
fprintf(F, "\tret\n");
fprintf(F, "\tret\n\n");
//printf(F, "\t.size\t%s, .-%s\n\n", irg_name, irg_name);
}
......
......@@ -403,6 +403,15 @@ $comment_string = ';';
"emit" => '. mov %ia32_emit_binop ; Store(%A3) -> (%A1) '
},
"Store8Bit" => {
"op_flags" => "L|F",
"state" => "exc_pinned",
"comment" => "construct 8Bit Store: Store(ptr, val, mem) = ST ptr,val",
"cmp_attr" => " return ia32_compare_immop_attr(attr_a, attr_b);\n",
"reg_req" => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ] },
"emit" => '. mov %ia32_emit_binop ; Store(%A3) -> (%A1)'
},
"Lea" => {
"irn_flags" => "R",
"comment" => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
......
......@@ -1233,6 +1233,9 @@ static ir_node *gen_Store(ia32_transform_env_t *env) {
if (mode_is_float(env->mode)) {
new_op = new_rd_ia32_fStore(env->dbg, env->irg, env->block, ptr, noreg, sval, mem, env->mode);
}
else if (get_mode_size_bits(env->mode) == 8) {
new_op = new_rd_ia32_Store8Bit(env->dbg, env->irg, env->block, ptr, noreg, sval, mem, env->mode);
}
else {
new_op = new_rd_ia32_Store(env->dbg, env->irg, env->block, ptr, noreg, sval, mem, env->mode);
}
......@@ -1619,6 +1622,9 @@ static ir_node *gen_FrameStore(ia32_transform_env_t *env) {
if (mode_is_float(mode)) {
new_op = new_rd_ia32_fStore(env->dbg, env->irg, env->block, ptr, noreg, val, mem, mode_T);
}
else if (get_mode_size_bits(mode) == 8) {
new_op = new_rd_ia32_Store8Bit(env->dbg, env->irg, env->block, ptr, noreg, val, mem, mode_T);
}
else {
new_op = new_rd_ia32_Store(env->dbg, env->irg, env->block, ptr, noreg, val, mem, mode_T);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment