/* Generic hooks for the RTL middle-end.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
{
/* Must be a hard reg that's not valid in MODE. */
result = gen_lowpart_common (mode, copy_to_reg (x));
- if (result == 0)
- abort ();
+ gcc_assert (result != 0);
return result;
}
- else if (MEM_P (x))
+ else
{
- /* The only additional case we can do is MEM. */
int offset = 0;
+ /* The only additional case we can do is MEM. */
+ gcc_assert (MEM_P (x));
+
/* The following exposes the use of "x" to CSE. */
if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD
&& SCALAR_INT_MODE_P (GET_MODE (x))
return adjust_address (x, mode, offset);
}
- else
- abort ();
+}
+
+/* Similar to gen_lowpart, but cannot emit any instruction via
+ copy_to_reg or force_reg. Mainly used in simplify-rtx.c. */
+rtx
+gen_lowpart_no_emit_general (enum machine_mode mode, rtx x)
+{
+ rtx result = gen_lowpart_common (mode, x);
+ if (result)
+ return result;
+ if (mode != GET_MODE (x) && GET_MODE (x) != VOIDmode)
+ return gen_lowpart_SUBREG (mode, x);
+ return x;
}
rtx