/* Emit RTL for the GCC expander.
- Copyright (C) 1987-2013 Free Software Foundation, Inc.
+ Copyright (C) 1987-2014 Free Software Foundation, Inc.
This file is part of GCC.
#include "diagnostic-core.h"
#include "rtl.h"
#include "tree.h"
+#include "varasm.h"
+#include "basic-block.h"
+#include "tree-eh.h"
#include "tm_p.h"
#include "flags.h"
#include "function.h"
+#include "stringpool.h"
#include "expr.h"
#include "regs.h"
#include "hard-reg-set.h"
#include "insn-config.h"
#include "recog.h"
#include "bitmap.h"
-#include "basic-block.h"
-#include "ggc.h"
#include "debug.h"
#include "langhooks.h"
#include "df.h"
static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
htab_t const_int_htab;
-/* A hash table storing memory attribute structures. */
-static GTY ((if_marked ("ggc_marked_p"), param_is (struct mem_attrs)))
- htab_t mem_attrs_htab;
-
/* A hash table storing register attribute structures. */
static GTY ((if_marked ("ggc_marked_p"), param_is (struct reg_attrs)))
htab_t reg_attrs_htab;
static hashval_t const_fixed_htab_hash (const void *);
static int const_fixed_htab_eq (const void *, const void *);
static rtx lookup_const_fixed (rtx);
-static hashval_t mem_attrs_htab_hash (const void *);
-static int mem_attrs_htab_eq (const void *, const void *);
static hashval_t reg_attrs_htab_hash (const void *);
static int reg_attrs_htab_eq (const void *, const void *);
static reg_attrs *get_reg_attrs (tree, int);
return fixed_identical (CONST_FIXED_VALUE (a), CONST_FIXED_VALUE (b));
}
-/* Returns a hash code for X (which is a really a mem_attrs *). */
-
-static hashval_t
-mem_attrs_htab_hash (const void *x)
-{
- const mem_attrs *const p = (const mem_attrs *) x;
-
- return (p->alias ^ (p->align * 1000)
- ^ (p->addrspace * 4000)
- ^ ((p->offset_known_p ? p->offset : 0) * 50000)
- ^ ((p->size_known_p ? p->size : 0) * 2500000)
- ^ (size_t) iterative_hash_expr (p->expr, 0));
-}
-
/* Return true if the given memory attributes are equal. */
static bool
&& operand_equal_p (p->expr, q->expr, 0))));
}
-/* Returns nonzero if the value represented by X (which is really a
- mem_attrs *) is the same as that given by Y (which is also really a
- mem_attrs *). */
-
-static int
-mem_attrs_htab_eq (const void *x, const void *y)
-{
- return mem_attrs_eq_p ((const mem_attrs *) x, (const mem_attrs *) y);
-}
-
/* Set MEM's memory attributes so that they are the same as ATTRS. */
static void
set_mem_attrs (rtx mem, mem_attrs *attrs)
{
- void **slot;
-
/* If everything is the default, we can just clear the attributes. */
if (mem_attrs_eq_p (attrs, mode_mem_attrs[(int) GET_MODE (mem)]))
{
return;
}
- slot = htab_find_slot (mem_attrs_htab, attrs, INSERT);
- if (*slot == 0)
+ if (!MEM_ATTRS (mem)
+ || !mem_attrs_eq_p (attrs, MEM_ATTRS (mem)))
{
- *slot = ggc_alloc_mem_attrs ();
- memcpy (*slot, attrs, sizeof (mem_attrs));
+ MEM_ATTRS (mem) = ggc_alloc_mem_attrs ();
+ memcpy (MEM_ATTRS (mem), attrs, sizeof (mem_attrs));
}
-
- MEM_ATTRS (mem) = (mem_attrs *) *slot;
}
/* Returns a hash code for X (which is a really a reg_attrs *). */
return gen_rtx_CONCAT (mode, realpart, imagpart);
}
+ /* Do not call gen_reg_rtx with uninitialized crtl. */
+ gcc_assert (crtl->emit.regno_pointer_align_length);
+
/* Make sure regno_pointer_align, and regno_reg_rtx are large
enough to have an element for this pseudo reg number. */
tree bit_offset = DECL_FIELD_BIT_OFFSET (field);
if (!byte_offset
- || !host_integerp (byte_offset, 1)
- || !host_integerp (bit_offset, 1))
+ || !tree_fits_uhwi_p (byte_offset)
+ || !tree_fits_uhwi_p (bit_offset))
return -1;
- offset += tree_low_cst (byte_offset, 1);
- offset += tree_low_cst (bit_offset, 1) / BITS_PER_UNIT;
+ offset += tree_to_uhwi (byte_offset);
+ offset += tree_to_uhwi (bit_offset) / BITS_PER_UNIT;
if (inner == NULL_TREE)
{
/* If this expression uses it's parent's alias set, mark it such
that we won't change it. */
- if (component_uses_parent_alias_set (t))
+ if (component_uses_parent_alias_set_from (t) != NULL_TREE)
MEM_KEEP_ALIAS_SET_P (ref) = 1;
/* If this is a decl, set the attributes of the MEM from it. */
{
attrs.expr = t2;
attrs.offset_known_p = false;
- if (host_integerp (off_tree, 1))
+ if (tree_fits_uhwi_p (off_tree))
{
attrs.offset_known_p = true;
- attrs.offset = tree_low_cst (off_tree, 1);
+ attrs.offset = tree_to_uhwi (off_tree);
apply_bitpos = bitpos;
}
}
attrs.align = MAX (attrs.align, obj_align);
}
- if (host_integerp (new_size, 1))
+ if (tree_fits_uhwi_p (new_size))
{
attrs.size_known_p = true;
- attrs.size = tree_low_cst (new_size, 1);
+ attrs.size = tree_to_uhwi (new_size);
}
/* If we modified OFFSET based on T, then subtract the outstanding
&& (!validate || memory_address_addr_space_p (mode, addr, as)))
return memref;
- if (validate)
+ /* Don't validate address for LRA. LRA can make the address valid
+ by itself in most efficient way. */
+ if (validate && !lra_in_progress)
{
if (reload_in_progress || reload_completed)
gcc_assert (memory_address_addr_space_p (mode, addr, as));
&& attrs.offset >= 0)
break;
- if (! host_integerp (offset, 1))
+ if (! tree_fits_uhwi_p (offset))
{
attrs.expr = NULL_TREE;
break;
}
attrs.expr = TREE_OPERAND (attrs.expr, 0);
- attrs.offset += tree_low_cst (offset, 1);
- attrs.offset += (tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1)
+ attrs.offset += tree_to_uhwi (offset);
+ attrs.offset += (tree_to_uhwi (DECL_FIELD_BIT_OFFSET (field))
/ BITS_PER_UNIT);
}
/* Similarly for the decl. */
if (any_condjump_p (trial)
&& (note = find_reg_note (trial, REG_BR_PROB, 0)))
- split_branch_probability = INTVAL (XEXP (note, 0));
+ split_branch_probability = XINT (note, 0);
probability = split_branch_probability;
seq = split_insns (pat, trial);
is responsible for this step using
split_branch_probability variable. */
gcc_assert (njumps == 1);
- add_reg_note (insn, REG_BR_PROB, GEN_INT (probability));
+ add_int_reg_note (insn, REG_BR_PROB, probability);
}
}
}
NEXT_INSN (to) = NEXT_INSN (after);
PREV_INSN (from) = after;
NEXT_INSN (after) = from;
- if (after == get_last_insn())
+ if (after == get_last_insn ())
set_last_insn (to);
}
if (after_after)
PREV_INSN (after_after) = last;
- if (after == get_last_insn())
+ if (after == get_last_insn ())
set_last_insn (last);
return last;
rtx
emit_insn (rtx x)
{
- rtx last = get_last_insn();
+ rtx last = get_last_insn ();
rtx insn;
if (x == NULL_RTX)
rtx
emit_debug_insn (rtx x)
{
- rtx last = get_last_insn();
+ rtx last = get_last_insn ();
rtx insn;
if (x == NULL_RTX)
const_fixed_htab = htab_create_ggc (37, const_fixed_htab_hash,
const_fixed_htab_eq, NULL);
- mem_attrs_htab = htab_create_ggc (37, mem_attrs_htab_hash,
- mem_attrs_htab_eq, NULL);
reg_attrs_htab = htab_create_ggc (37, reg_attrs_htab_hash,
reg_attrs_htab_eq, NULL);
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
}
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
}
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
/* We store the value 1. */
- FCONST1(mode).data.high = 0;
- FCONST1(mode).data.low = 0;
- FCONST1(mode).mode = mode;
- FCONST1(mode).data
+ FCONST1 (mode).data.high = 0;
+ FCONST1 (mode).data.low = 0;
+ FCONST1 (mode).mode = mode;
+ FCONST1 (mode).data
= double_int_one.lshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
/* We store the value 1. */
- FCONST1(mode).data.high = 0;
- FCONST1(mode).data.low = 0;
- FCONST1(mode).mode = mode;
- FCONST1(mode).data
+ FCONST1 (mode).data.high = 0;
+ FCONST1 (mode).data.low = 0;
+ FCONST1 (mode).mode = mode;
+ FCONST1 (mode).data
= double_int_one.lshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
add_reg_note (new_rtx, REG_NOTE_KIND (link),
copy_insn_1 (XEXP (link, 0)));
else
- add_reg_note (new_rtx, REG_NOTE_KIND (link), XEXP (link, 0));
+ add_shallow_copy_of_reg_note (new_rtx, link);
}
INSN_CODE (new_rtx) = INSN_CODE (insn);