* @brief This file implements the ia32 node emitter.
* @author Christian Wuerdig, Matthias Braun
* @version $Id$
+ *
+ * Summary table for x86 floatingpoint compares:
+ * pnc_Eq => !P && E
+ * pnc_Lt => !P && B
+ * pnc_Le => !P && BE
+ * pnc_Gt => A
+ * pnc_Ge => AE
+ * pnc_Lg => P || NE
+ * pnc_Leg => NP (ordered)
+ * pnc_Uo => P
+ * pnc_Ue => E
+ * pnc_Ul => B
+ * pnc_Ule => BE
+ * pnc_Ug => P || A
+ * pnc_Uge => P || AE
+ * pnc_Ne => NE
*/
#include "config.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
-#define BLOCK_PREFIX ".L"
-
#define SNPRINTF_BUF_LEN 128
static const ia32_isa_t *isa;
be_gas_emit_entity(entity);
if (get_entity_owner(entity) == get_tls_type()) {
- if (get_entity_linkage(entity) & IR_LINKAGE_EXTERN) {
+ if (get_entity_visibility(entity) == ir_visibility_external) {
be_emit_cstring("@INDNTPOFF");
} else {
be_emit_cstring("@NTPOFF");
return get_irn_link(irn);
}
-/**
- * Emits a block label for the given block.
- */
-static void ia32_emit_block_name(const ir_node *block)
-{
- if (has_Block_entity(block)) {
- ir_entity *entity = get_Block_entity(block);
- be_gas_emit_entity(entity);
- } else {
- be_emit_cstring(BLOCK_PREFIX);
- be_emit_irprintf("%ld", get_irn_node_nr(block));
- }
-}
-
/**
* Emits the target label for a control flow node.
*/
static void ia32_emit_cfop_target(const ir_node *node)
{
ir_node *block = get_cfop_target_block(node);
- ia32_emit_block_name(block);
+ be_gas_emit_block_name(block);
}
/*
return get_negated_pnc(pnc, mode);
}
-void ia32_emit_cmp_suffix_node(const ir_node *node,
- int flags_pos)
+void ia32_emit_cmp_suffix_node(const ir_node *node, int flags_pos)
{
- const ia32_attr_t *attr = get_ia32_attr_const(node);
-
pn_Cmp pnc = get_ia32_condcode(node);
-
pnc = determine_final_pnc(node, flags_pos, pnc);
- if (attr->data.ins_permuted)
- pnc = ia32_get_negated_pnc(pnc);
ia32_emit_cmp_suffix(pnc);
}
pnc = determine_final_pnc(node, n_ia32_CMovcc_eflags, pnc);
/* although you can't set ins_permuted in the constructor it might still
- be set by memory operand folding */
+ * be set by memory operand folding
+ * Permuting inputs of a cmov means the condition is negated!
+ */
if (attr->data.ins_permuted)
pnc = ia32_get_negated_pnc(pnc);
ia32_emitf(node, "\tmovl %S0, %D0\n");
ia32_emitf(node, "\tmovl $%u, %S1\n", attr->count);
- ia32_emitf(NULL, BLOCK_PREFIX "%ld:\n", get_irn_node_nr(node));
+ be_gas_emit_block_name(node);
+ be_emit_cstring(":\n");
+ be_emit_write_line();
ia32_emitf(node, "\tmovl (%D0), %D0\n");
ia32_emitf(node, "\tdec %S1\n");
- ia32_emitf(node, "\tjnz " BLOCK_PREFIX "%ld\n", get_irn_node_nr(node));
+ be_emit_cstring("\tjnz ");
+ be_gas_emit_block_name(node);
+ be_emit_finish_line_gas(node);
}
static void emit_be_Return(const ir_node *node)
}
if (need_label) {
- ia32_emit_block_name(block);
+ be_gas_emit_block_name(block);
be_emit_char(':');
be_emit_pad_comment();
be_emit_cstring(" /* ");
} else {
be_emit_cstring("\t/* ");
- ia32_emit_block_name(block);
+ be_gas_emit_block_name(block);
be_emit_cstring(": ");
}
ia32_emit_exc_label(exc_list[i].exc_instr);
be_emit_char('\n');
be_emit_cstring("\t.long ");
- ia32_emit_block_name(exc_list[i].block);
+ be_gas_emit_block_name(exc_list[i].block);
be_emit_char('\n');
}
}
be_gas_emit_entity(entity);
if (get_entity_owner(entity) == get_tls_type()) {
- if (get_entity_linkage(entity) & IR_LINKAGE_EXTERN) {
+ if (get_entity_visibility(entity) == ir_visibility_external) {
be_emit_cstring("@INDNTPOFF");
} else {
be_emit_cstring("@NTPOFF");
static void bemit_jmp_destination(const ir_node *dest_block)
{
be_emit_cstring("\t.long ");
- ia32_emit_block_name(dest_block);
+ be_gas_emit_block_name(dest_block);
be_emit_cstring(" - . - 4\n");
be_emit_write_line();
}