/* Emit RTL for the GNU C-Compiler expander.
- Copyright (C) 1987, 1988, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1988, 1992, 1993 Free Software Foundation, Inc.
This file is part of GNU CC.
is the kind of rtx's they make and what arguments they use. */
#include "config.h"
-#include <stdio.h>
#include "gvarargs.h"
#include "rtl.h"
#include "flags.h"
#include "regs.h"
#include "insn-config.h"
#include "real.h"
+#include <stdio.h>
/* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
After rtl generation, it is 1 plus the largest register number used. */
** special machine mode associated with the rtx (if any) is specified
** in <mode>.
**
-** gen_rtx() can be invoked in a way which resembles the lisp-like
+** gen_rtx can be invoked in a way which resembles the lisp-like
** rtx it will generate. For example, the following rtx structure:
**
** (plus:QI (mem:QI (reg:SI 1))
if (code == CONST_INT)
{
- int arg = va_arg (p, int);
+ HOST_WIDE_INT arg = va_arg (p, HOST_WIDE_INT);
if (arg >= - MAX_SAVED_CONST_INT && arg <= MAX_SAVED_CONST_INT)
return const_int_rtx[arg + MAX_SAVED_CONST_INT];
If we have eliminated the frame pointer or arg pointer, we will
be using it as a normal register, for example as a spill register.
In such cases, we might be accessing it in a mode that is not
- Pmode and therefore cannot use the pre-allocated rtx. */
+ Pmode and therefore cannot use the pre-allocated rtx.
+
+ Also don't do this when we are making new REGs in reload,
+ since we don't want to get confused with the real pointers. */
- if (frame_pointer_rtx && regno == FRAME_POINTER_REGNUM && mode == Pmode)
+ if (frame_pointer_rtx && regno == FRAME_POINTER_REGNUM && mode == Pmode
+ && ! reload_in_progress)
return frame_pointer_rtx;
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- if (arg_pointer_rtx && regno == ARG_POINTER_REGNUM && mode == Pmode)
+ if (arg_pointer_rtx && regno == ARG_POINTER_REGNUM && mode == Pmode
+ && ! reload_in_progress)
return arg_pointer_rtx;
#endif
- if (stack_pointer_rtx && regno == STACK_POINTER_REGNUM && mode == Pmode)
+ if (stack_pointer_rtx && regno == STACK_POINTER_REGNUM && mode == Pmode
+ && ! reload_in_progress)
return stack_pointer_rtx;
else
{
XINT (rt_val, i) = va_arg (p, int);
break;
+ case 'w': /* A wide integer? */
+ XWINT (rt_val, i) = va_arg (p, HOST_WIDE_INT);
+ break;
+
case 's': /* A string? */
XSTR (rt_val, i) = va_arg (p, char *);
break;
break;
default:
- abort();
+ abort ();
}
}
}
/ UNITS_PER_WORD);
if ((GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND)
- && GET_MODE_CLASS (mode) == MODE_INT)
+ && (GET_MODE_CLASS (mode) == MODE_INT
+ || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT))
{
/* If we are getting the low-order part of something that has been
sign- or zero-extended, we can either just use the object being
else if (REGNO (x) < FIRST_PSEUDO_REGISTER
/* integrate.c can't handle parts of a return value register. */
&& (! REG_FUNCTION_VALUE_P (x)
- || ! rtx_equal_function_value_matters))
+ || ! rtx_equal_function_value_matters)
+ /* We want to keep the stack, frame, and arg pointers
+ special. */
+ && REGNO (x) != FRAME_POINTER_REGNUM
+#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ && REGNO (x) != ARG_POINTER_REGNUM
+#endif
+ && REGNO (x) != STACK_POINTER_REGNUM)
return gen_rtx (REG, mode, REGNO (x) + word);
else
return gen_rtx (SUBREG, mode, x, word);
/* If X is a CONST_INT or a CONST_DOUBLE, extract the appropriate bits
from the low-order part of the constant. */
- else if (GET_MODE_CLASS (mode) == MODE_INT && GET_MODE (x) == VOIDmode
+ else if ((GET_MODE_CLASS (mode) == MODE_INT
+ || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
+ && GET_MODE (x) == VOIDmode
&& (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE))
- return (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_INT ? x
- : (GET_MODE_BITSIZE (mode) == HOST_BITS_PER_INT
- && GET_CODE (x) == CONST_INT) ? x
- : gen_rtx (CONST_INT, VOIDmode,
- (GET_MODE_MASK (mode)
- & (GET_CODE (x) == CONST_INT
- ? INTVAL (x) : CONST_DOUBLE_LOW (x)))));
+ {
+ /* If MODE is twice the host word size, X is already the desired
+ representation. Otherwise, if MODE is wider than a word, we can't
+ do this. If MODE is exactly a word, return just one CONST_INT.
+ If MODE is smaller than a word, clear the bits that don't belong
+ in our mode, unless they and our sign bit are all one. So we get
+ either a reasonable negative value or a reasonable unsigned value
+ for this mode. */
+
+ if (GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT)
+ return x;
+ else if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT)
+ return 0;
+ else if (GET_MODE_BITSIZE (mode) == HOST_BITS_PER_WIDE_INT)
+ return (GET_CODE (x) == CONST_INT ? x
+ : GEN_INT (CONST_DOUBLE_LOW (x)));
+ else
+ {
+ /* MODE must be narrower than HOST_BITS_PER_INT. */
+ int width = GET_MODE_BITSIZE (mode);
+ HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x)
+ : CONST_DOUBLE_LOW (x));
+
+ if (((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
+ != ((HOST_WIDE_INT) (-1) << (width - 1))))
+ val &= ((HOST_WIDE_INT) 1 << width) - 1;
+
+ return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x
+ : GEN_INT (val));
+ }
+ }
+
+ /* If X is an integral constant but we want it in floating-point, it
+ must be the case that we have a union of an integer and a floating-point
+ value. If the machine-parameters allow it, simulate that union here
+ and return the result. The two-word and single-word cases are
+ different. */
+
+ else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
+ && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
+ || flag_pretend_float)
+ && GET_MODE_CLASS (mode) == MODE_FLOAT
+ && GET_MODE_SIZE (mode) == UNITS_PER_WORD
+ && GET_CODE (x) == CONST_INT
+ && sizeof (float) * HOST_BITS_PER_CHAR == HOST_BITS_PER_WIDE_INT)
+ {
+ union {HOST_WIDE_INT i; float d; } u;
+
+ u.i = INTVAL (x);
+ return immed_real_const_1 (u.d, mode);
+ }
+
+ else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
+ && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
+ || flag_pretend_float)
+ && GET_MODE_CLASS (mode) == MODE_FLOAT
+ && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
+ && (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
+ && GET_MODE (x) == VOIDmode
+ && (sizeof (double) * HOST_BITS_PER_CHAR
+ == 2 * HOST_BITS_PER_WIDE_INT))
+ {
+ union {HOST_WIDE_INT i[2]; double d; } u;
+ HOST_WIDE_INT low, high;
+
+ if (GET_CODE (x) == CONST_INT)
+ low = INTVAL (x), high = low >> (HOST_BITS_PER_WIDE_INT -1);
+ else
+ low = CONST_DOUBLE_LOW (x), high = CONST_DOUBLE_HIGH (x);
+
+#ifdef HOST_WORDS_BIG_ENDIAN
+ u.i[0] = high, u.i[1] = low;
+#else
+ u.i[0] = low, u.i[1] = high;
+#endif
+
+ return immed_real_const_1 (u.d, mode);
+ }
+
+ /* Similarly, if this is converting a floating-point value into a
+ single-word integer. Only do this is the host and target parameters are
+ compatible. */
+
+ else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
+ && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
+ || flag_pretend_float)
+ && (GET_MODE_CLASS (mode) == MODE_INT
+ || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
+ && GET_CODE (x) == CONST_DOUBLE
+ && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT
+ && GET_MODE_BITSIZE (mode) == BITS_PER_WORD)
+ return operand_subword (x, 0, 0, GET_MODE (x));
+
+ /* Similarly, if this is converting a floating-point value into a
+ two-word integer, we can do this one word at a time and make an
+ integer. Only do this is the host and target parameters are
+ compatible. */
+
+ else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
+ && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
+ || flag_pretend_float)
+ && (GET_MODE_CLASS (mode) == MODE_INT
+ || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
+ && GET_CODE (x) == CONST_DOUBLE
+ && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT
+ && GET_MODE_BITSIZE (mode) == 2 * BITS_PER_WORD)
+ {
+ rtx lowpart = operand_subword (x, WORDS_BIG_ENDIAN, 0, GET_MODE (x));
+ rtx highpart = operand_subword (x, ! WORDS_BIG_ENDIAN, 0, GET_MODE (x));
+
+ if (lowpart && GET_CODE (lowpart) == CONST_INT
+ && highpart && GET_CODE (highpart) == CONST_INT)
+ return immed_double_const (INTVAL (lowpart), INTVAL (highpart), mode);
+ }
/* Otherwise, we can't do this. */
return 0;
}
\f
+/* Return the real part (which has mode MODE) of a complex value X.
+ This always comes at the low address in memory. */
+
+rtx
+gen_realpart (mode, x)
+ enum machine_mode mode;
+ register rtx x;
+{
+ if (WORDS_BIG_ENDIAN)
+ return gen_highpart (mode, x);
+ else
+ return gen_lowpart (mode, x);
+}
+
+/* Return the imaginary part (which has mode MODE) of a complex value X.
+ This always comes at the high address in memory. */
+
+rtx
+gen_imagpart (mode, x)
+ enum machine_mode mode;
+ register rtx x;
+{
+ if (WORDS_BIG_ENDIAN)
+ return gen_lowpart (mode, x);
+ else
+ return gen_highpart (mode, x);
+}
+\f
/* Assuming that X is an rtx (e.g., MEM, REG or SUBREG) for a value,
return an rtx (MEM, SUBREG, or CONST_INT) that refers to the
least-significant part of X.
abort ();
}
+/* Like `gen_lowpart', but refer to the most significant part.
+ This is used to access the imaginary part of a complex number. */
+
+rtx
+gen_highpart (mode, x)
+ enum machine_mode mode;
+ register rtx x;
+{
+ /* This case loses if X is a subreg. To catch bugs early,
+ complain if an invalid MODE is used even in other cases. */
+ if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
+ && GET_MODE_SIZE (mode) != GET_MODE_UNIT_SIZE (GET_MODE (x)))
+ abort ();
+ if (GET_CODE (x) == CONST_DOUBLE
+#if !(TARGET_FLOAT_FORMAT != HOST_FLOAT_FORMAT || defined (REAL_IS_NOT_DOUBLE))
+ && GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT
+#endif
+ )
+ return gen_rtx (CONST_INT, VOIDmode,
+ CONST_DOUBLE_HIGH (x) & GET_MODE_MASK (mode));
+ else if (GET_CODE (x) == CONST_INT)
+ return const0_rtx;
+ else if (GET_CODE (x) == MEM)
+ {
+ register int offset = 0;
+#if !WORDS_BIG_ENDIAN
+ offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD)
+ - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD));
+#endif
+#if !BYTES_BIG_ENDIAN
+ if (GET_MODE_SIZE (mode) < UNITS_PER_WORD)
+ offset -= (GET_MODE_SIZE (mode)
+ - MIN (UNITS_PER_WORD,
+ GET_MODE_SIZE (GET_MODE (x))));
+#endif
+ return change_address (x, mode, plus_constant (XEXP (x, 0), offset));
+ }
+ else if (GET_CODE (x) == SUBREG)
+ {
+ /* The only time this should occur is when we are looking at a
+ multi-word item with a SUBREG whose mode is the same as that of the
+ item. It isn't clear what we would do if it wasn't. */
+ if (SUBREG_WORD (x) != 0)
+ abort ();
+ return gen_highpart (mode, SUBREG_REG (x));
+ }
+ else if (GET_CODE (x) == REG)
+ {
+ int word = 0;
+
+#if !WORDS_BIG_ENDIAN
+ if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
+ word = ((GET_MODE_SIZE (GET_MODE (x))
+ - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
+ / UNITS_PER_WORD);
+#endif
+ if (REGNO (x) < FIRST_PSEUDO_REGISTER
+ /* We want to keep the stack, frame, and arg pointers special. */
+ && REGNO (x) != FRAME_POINTER_REGNUM
+#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ && REGNO (x) != ARG_POINTER_REGNUM
+#endif
+ && REGNO (x) != STACK_POINTER_REGNUM)
+ return gen_rtx (REG, mode, REGNO (x) + word);
+ else
+ return gen_rtx (SUBREG, mode, x, word);
+ }
+ else
+ abort ();
+}
+
/* Return 1 iff X, assumed to be a SUBREG,
refers to the least significant part of its containing reg.
If X is not a SUBREG, always return 1 (it is its own low part!). */
int validate_address;
enum machine_mode mode;
{
- int val;
- int size_ratio = HOST_BITS_PER_INT / BITS_PER_WORD;
+ HOST_WIDE_INT val;
+ int size_ratio = HOST_BITS_PER_WIDE_INT / BITS_PER_WORD;
if (mode == VOIDmode)
mode = GET_MODE (op);
return 0;
else if (REGNO (op) >= FIRST_PSEUDO_REGISTER
|| (REG_FUNCTION_VALUE_P (op)
- && rtx_equal_function_value_matters))
+ && rtx_equal_function_value_matters)
+ /* We want to keep the stack, frame, and arg pointers
+ special. */
+ || REGNO (op) == FRAME_POINTER_REGNUM
+#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+ || REGNO (op) == ARG_POINTER_REGNUM
+#endif
+ || REGNO (op) == STACK_POINTER_REGNUM)
return gen_rtx (SUBREG, word_mode, op, i);
else
return gen_rtx (REG, word_mode, REGNO (op) + i);
/* The only remaining cases are when OP is a constant. If the host and
target floating formats are the same, handling two-word floating
constants are easy. */
+#ifdef REAL_ARITHMETIC
+ if ((HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
+ && GET_MODE_CLASS (mode) == MODE_FLOAT
+ && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
+ && GET_CODE (op) == CONST_DOUBLE)
+ {
+ HOST_WIDE_INT k[2];
+ REAL_VALUE_TYPE rv;
+
+ REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
+ REAL_VALUE_TO_TARGET_DOUBLE (rv, k);
+ return GEN_INT (k[i]);
+ }
+#else /* no REAL_ARITHMETIC */
if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_INT == BITS_PER_WORD)
+ && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_FLOAT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
&& GET_CODE (op) == CONST_DOUBLE)
- return gen_rtx (CONST_INT, VOIDmode,
- i ? CONST_DOUBLE_HIGH (op) : CONST_DOUBLE_LOW (op));
+ {
+ /* The constant is stored in the host's word-ordering,
+ but we want to access it in the target's word-ordering. Some
+ compilers don't like a conditional inside macro args, so we have two
+ copies of the return. */
+#ifdef HOST_WORDS_BIG_ENDIAN
+ return GEN_INT (i == WORDS_BIG_ENDIAN
+ ? CONST_DOUBLE_HIGH (op) : CONST_DOUBLE_LOW (op));
+#else
+ return GEN_INT (i != WORDS_BIG_ENDIAN
+ ? CONST_DOUBLE_HIGH (op) : CONST_DOUBLE_LOW (op));
+#endif
+ }
+#endif /* no REAL_ARITHMETIC */
/* Single word float is a little harder, since single- and double-word
values often do not have the same high-order bits. We have already
verified that we want the only defined word of the single-word value. */
+#ifdef REAL_ARITHMETIC
+ if ((HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
+ && GET_MODE_CLASS (mode) == MODE_FLOAT
+ && GET_MODE_SIZE (mode) == UNITS_PER_WORD
+ && GET_CODE (op) == CONST_DOUBLE)
+ {
+ HOST_WIDE_INT l;
+ REAL_VALUE_TYPE rv;
+
+ REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
+ REAL_VALUE_TO_TARGET_SINGLE (rv, l);
+ return GEN_INT (l);
+ }
+#else
if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
- && HOST_BITS_PER_INT == BITS_PER_WORD)
+ && HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_FLOAT
&& GET_MODE_SIZE (mode) == UNITS_PER_WORD
&& GET_CODE (op) == CONST_DOUBLE)
{
double d;
- union {float f; int i; } u;
+ union {float f; HOST_WIDE_INT i; } u;
REAL_VALUE_FROM_CONST_DOUBLE (d, op);
u.f = d;
- return gen_rtx (CONST_INT, VOIDmode, u.i);
+ return GEN_INT (u.i);
}
+#endif /* no REAL_ARITHMETIC */
/* The only remaining cases that we can handle are integers.
Convert to proper endianness now since these cases need it.
At this point, i == 0 means the low-order word.
- Note that it must be that BITS_PER_WORD <= HOST_BITS_PER_INT.
- This is because if it were greater, it could only have been two
- times greater since we do not support making wider constants. In
- that case, it MODE would have already been the proper size and
- it would have been handled above. This means we do not have to
- worry about the case where we would be returning a CONST_DOUBLE. */
+ We do not want to handle the case when BITS_PER_WORD <= HOST_BITS_PER_INT
+ in general. However, if OP is (const_int 0), we can just return
+ it for any word. */
+
+ if (op == const0_rtx)
+ return op;
if (GET_MODE_CLASS (mode) != MODE_INT
- || (GET_CODE (op) != CONST_INT && GET_CODE (op) != CONST_DOUBLE))
+ || (GET_CODE (op) != CONST_INT && GET_CODE (op) != CONST_DOUBLE)
+ || BITS_PER_WORD > HOST_BITS_PER_INT)
return 0;
if (WORDS_BIG_ENDIAN)
? (INTVAL (op) < 0 ? ~0 : 0) : CONST_DOUBLE_HIGH (op)));
/* If BITS_PER_WORD is smaller than an int, get the appropriate bits. */
- if (BITS_PER_WORD < HOST_BITS_PER_INT)
+ if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT)
val = ((val >> ((i % size_ratio) * BITS_PER_WORD))
- & ((1 << (BITS_PER_WORD % HOST_BITS_PER_INT)) - 1));
+ & (((HOST_WIDE_INT) 1
+ << (BITS_PER_WORD % HOST_BITS_PER_WIDE_INT)) - 1));
- return gen_rtx (CONST_INT, VOIDmode, val);
+ return GEN_INT (val);
}
/* Similar to `operand_subword', but never return 0. If we can't extract
rtx
gen_label_rtx ()
{
- register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, label_num++, 0);
+ register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0,
+ label_num++, NULL_PTR);
LABEL_NUSES (label) = 0;
return label;
}
rtx original_decl_initial;
{
rtx header = gen_rtx (INLINE_HEADER, VOIDmode,
- cur_insn_uid++, NULL,
+ cur_insn_uid++, NULL_RTX,
first_insn, first_parm_insn,
first_labelno, last_labelno,
max_parm_regnum, max_regnum, args_size, pops_args,
/* SCRATCH must be shared because they represent distinct values. */
return x;
+ case CONST:
+ /* CONST can be shared if it contains a SYMBOL_REF. If it contains
+ a LABEL_REF, it isn't sharable. */
+ if (GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
+ && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)
+ return x;
+ break;
+
case INSN:
case JUMP_INSN:
case CALL_INSN:
}
\f
#ifdef HAVE_cc0
+/* INSN uses CC0 and is being moved into a delay slot. Set up REG_CC_SETTER
+ and REG_CC_USER notes so we can find it. */
+
+void
+link_cc0_insns (insn)
+ rtx insn;
+{
+ rtx user = next_nonnote_insn (insn);
+
+ if (GET_CODE (user) == INSN && GET_CODE (PATTERN (user)) == SEQUENCE)
+ user = XVECEXP (PATTERN (user), 0, 0);
+
+ REG_NOTES (user) = gen_rtx (INSN_LIST, REG_CC_SETTER, insn,
+ REG_NOTES (user));
+ REG_NOTES (insn) = gen_rtx (INSN_LIST, REG_CC_USER, user, REG_NOTES (insn));
+}
+
/* Return the next insn that uses CC0 after INSN, which is assumed to
set it. This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
applied to the result of this function should yield INSN).
next_cc0_user (insn)
rtx insn;
{
- rtx note = find_reg_note (insn, REG_CC_USER, 0);
+ rtx note = find_reg_note (insn, REG_CC_USER, NULL_RTX);
if (note)
return XEXP (note, 0);
prev_cc0_setter (insn)
rtx insn;
{
- rtx note = find_reg_note (insn, REG_CC_SETTER, 0);
+ rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
rtx link;
if (note)
}
\f
/* Make and return an INSN rtx, initializing all its slots.
- Store PATTERN in the pattern slots.
- PAT_FORMALS is an idea that never really went anywhere. */
+ Store PATTERN in the pattern slots. */
rtx
-make_insn_raw (pattern, pat_formals)
+make_insn_raw (pattern)
rtx pattern;
- rtvec pat_formals;
{
register rtx insn;
- insn = rtx_alloc(INSN);
- INSN_UID(insn) = cur_insn_uid++;
+ insn = rtx_alloc (INSN);
+ INSN_UID (insn) = cur_insn_uid++;
PATTERN (insn) = pattern;
INSN_CODE (insn) = -1;
- LOG_LINKS(insn) = NULL;
- REG_NOTES(insn) = NULL;
+ LOG_LINKS (insn) = NULL;
+ REG_NOTES (insn) = NULL;
return insn;
}
/* Like `make_insn' but make a JUMP_INSN instead of an insn. */
static rtx
-make_jump_insn_raw (pattern, pat_formals)
+make_jump_insn_raw (pattern)
rtx pattern;
- rtvec pat_formals;
{
register rtx insn;
- insn = rtx_alloc(JUMP_INSN);
- INSN_UID(insn) = cur_insn_uid++;
+ insn = rtx_alloc (JUMP_INSN);
+ INSN_UID (insn) = cur_insn_uid++;
PATTERN (insn) = pattern;
INSN_CODE (insn) = -1;
- LOG_LINKS(insn) = NULL;
- REG_NOTES(insn) = NULL;
- JUMP_LABEL(insn) = NULL;
+ LOG_LINKS (insn) = NULL;
+ REG_NOTES (insn) = NULL;
+ JUMP_LABEL (insn) = NULL;
return insn;
}
}
else
{
- insn = make_insn_raw (pattern, 0);
+ insn = make_insn_raw (pattern);
add_insn_after (insn, PREV_INSN (before));
}
insn = emit_insn_before (pattern, before);
else
{
- insn = make_jump_insn_raw (pattern, 0);
+ insn = make_jump_insn_raw (pattern);
add_insn_after (insn, PREV_INSN (before));
}
}
else
{
- insn = make_insn_raw (pattern, 0);
+ insn = make_insn_raw (pattern);
add_insn_after (insn, after);
}
return insn;
}
+/* Similar to emit_insn_after, except that line notes are to be inserted so
+ as to act as if this insn were at FROM. */
+
+void
+emit_insn_after_with_line_notes (pattern, after, from)
+ rtx pattern, after, from;
+{
+ rtx from_line = find_line_note (from);
+ rtx after_line = find_line_note (after);
+ rtx insn = emit_insn_after (pattern, after);
+
+ if (from_line)
+ emit_line_note_after (NOTE_SOURCE_FILE (from_line),
+ NOTE_LINE_NUMBER (from_line),
+ after);
+
+ if (after_line)
+ emit_line_note_after (NOTE_SOURCE_FILE (after_line),
+ NOTE_LINE_NUMBER (after_line),
+ insn);
+}
+
/* Make an insn of code JUMP_INSN with body PATTERN
and output it after the insn AFTER. */
insn = emit_insn_after (pattern, after);
else
{
- insn = make_jump_insn_raw (pattern, 0);
+ insn = make_jump_insn_raw (pattern);
add_insn_after (insn, after);
}
}
else
{
- insn = make_insn_raw (pattern, NULL);
+ insn = make_insn_raw (pattern);
add_insn (insn);
}
return last;
}
+/* Emit the insns in a chain starting with FIRST and place them in back of
+ the insn AFTER. Return the last insn emitted. */
+
+rtx
+emit_insns_after (first, after)
+ register rtx first;
+ register rtx after;
+{
+ register rtx last;
+ register rtx after_after;
+
+ if (!after)
+ abort ();
+
+ if (!first)
+ return first;
+
+ for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
+ continue;
+
+ after_after = NEXT_INSN (after);
+
+ NEXT_INSN (after) = first;
+ PREV_INSN (first) = after;
+ NEXT_INSN (last) = after_after;
+ if (after_after)
+ PREV_INSN (after_after) = last;
+
+ if (after == last_insn)
+ last_insn = last;
+ return last;
+}
+
/* Make an insn of code JUMP_INSN with pattern PATTERN
and add it to the end of the doubly-linked list. */
return emit_insn (pattern);
else
{
- register rtx insn = make_jump_insn_raw (pattern, NULL);
+ register rtx insn = make_jump_insn_raw (pattern);
add_insn (insn);
return insn;
}
return emit_insn (pattern);
else
{
- register rtx insn = make_insn_raw (pattern, NULL);
+ register rtx insn = make_insn_raw (pattern);
add_insn (insn);
PUT_CODE (insn, CALL_INSN);
return insn;
last_insn = last;
}
+/* Set up the outer-level insn chain
+ as the current sequence, saving the previously current one. */
+
+void
+push_topmost_sequence ()
+{
+ struct sequence_stack *stack, *top;
+
+ start_sequence ();
+
+ for (stack = sequence_stack; stack; stack = stack->next)
+ top = stack;
+
+ first_insn = top->first;
+ last_insn = top->last;
+}
+
+/* After emitting to the outer-level insn chain, update the outer-level
+ insn chain, and restore the previous saved state. */
+
+void
+pop_topmost_sequence ()
+{
+ struct sequence_stack *stack, *top;
+
+ for (stack = sequence_stack; stack; stack = stack->next)
+ top = stack;
+
+ top->first = first_insn;
+ top->last = last_insn;
+
+ end_sequence ();
+}
+
/* After emitting to a sequence, restore previous saved state.
To get the contents of the sequence just made,
{
/* Ensure that this rtl goes in saveable_obstack, since we may be
caching it. */
- int in_current_obstack = rtl_in_saveable_obstack ();
+ push_obstacks_nochange ();
+ rtl_in_saveable_obstack ();
result = gen_rtx (SEQUENCE, VOIDmode, rtvec_alloc (len));
- if (in_current_obstack)
- rtl_in_current_obstack ();
+ pop_obstacks ();
}
for (i = 0, tem = first_insn; tem; tem = NEXT_INSN (tem), i++)
last_filename = 0;
first_label_num = label_num;
last_label_num = 0;
+ sequence_stack = NULL;
/* Clear the start_sequence/gen_sequence cache. */
sequence_element_free_list = 0;
regno_reg_rtx[VIRTUAL_STACK_VARS_REGNUM] = virtual_stack_vars_rtx;
regno_reg_rtx[VIRTUAL_STACK_DYNAMIC_REGNUM] = virtual_stack_dynamic_rtx;
regno_reg_rtx[VIRTUAL_OUTGOING_ARGS_REGNUM] = virtual_outgoing_args_rtx;
+
+ /* Indicate that the virtual registers and stack locations are
+ all pointers. */
+ REGNO_POINTER_FLAG (STACK_POINTER_REGNUM) = 1;
+ REGNO_POINTER_FLAG (FRAME_POINTER_REGNUM) = 1;
+ REGNO_POINTER_FLAG (ARG_POINTER_REGNUM) = 1;
+
+ REGNO_POINTER_FLAG (VIRTUAL_INCOMING_ARGS_REGNUM) = 1;
+ REGNO_POINTER_FLAG (VIRTUAL_STACK_VARS_REGNUM) = 1;
+ REGNO_POINTER_FLAG (VIRTUAL_STACK_DYNAMIC_REGNUM) = 1;
+ REGNO_POINTER_FLAG (VIRTUAL_OUTGOING_ARGS_REGNUM) = 1;
+
+#ifdef INIT_EXPANDERS
+ INIT_EXPANDERS;
+#endif
}
/* Create some permanent unique rtl objects shared between all functions.
}
/* These four calls obtain some of the rtx expressions made above. */
- const0_rtx = gen_rtx (CONST_INT, VOIDmode, 0);
- const1_rtx = gen_rtx (CONST_INT, VOIDmode, 1);
- const2_rtx = gen_rtx (CONST_INT, VOIDmode, 2);
- constm1_rtx = gen_rtx (CONST_INT, VOIDmode, -1);
+ const0_rtx = GEN_INT (0);
+ const1_rtx = GEN_INT (1);
+ const2_rtx = GEN_INT (2);
+ constm1_rtx = GEN_INT (-1);
/* This will usually be one of the above constants, but may be a new rtx. */
- const_true_rtx = gen_rtx (CONST_INT, VOIDmode, STORE_FLAG_VALUE);
+ const_true_rtx = GEN_INT (STORE_FLAG_VALUE);
- dconst0 = REAL_VALUE_ATOF ("0");
- dconst1 = REAL_VALUE_ATOF ("1");
- dconst2 = REAL_VALUE_ATOF ("2");
- dconstm1 = REAL_VALUE_ATOF ("-1");
+ dconst0 = REAL_VALUE_ATOF ("0", DFmode);
+ dconst1 = REAL_VALUE_ATOF ("1", DFmode);
+ dconst2 = REAL_VALUE_ATOF ("2", DFmode);
+ dconstm1 = REAL_VALUE_ATOF ("-1", DFmode);
for (i = 0; i <= 2; i++)
{
const_tiny_rtx[i][(int) mode] = tem;
}
- const_tiny_rtx[i][(int) VOIDmode] = gen_rtx (CONST_INT, VOIDmode, i);
+ const_tiny_rtx[i][(int) VOIDmode] = GEN_INT (i);
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
- const_tiny_rtx[i][(int) mode] = gen_rtx (CONST_INT, VOIDmode, i);
+ const_tiny_rtx[i][(int) mode] = GEN_INT (i);
+
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_PARTIAL_INT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ const_tiny_rtx[i][(int) mode] = GEN_INT (i);
}
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_CC); mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ const_tiny_rtx[0][(int) mode] = const0_rtx;
+
stack_pointer_rtx = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);
frame_pointer_rtx = gen_rtx (REG, Pmode, FRAME_POINTER_REGNUM);