[llvm-commits] [llvm-gcc-4.2] r54193 - in /llvm-gcc-4.2/trunk/gcc: final.c fold-const.c libgcc2.c tree.h
Bill Wendling
isanbard at gmail.com
Tue Jul 29 20:47:56 PDT 2008
Author: void
Date: Tue Jul 29 22:47:56 2008
New Revision: 54193
URL: http://llvm.org/viewvc/llvm-project?rev=54193&view=rev
Log:
Merges from Apple's GCC 4.2 r148430
Modified:
llvm-gcc-4.2/trunk/gcc/final.c
llvm-gcc-4.2/trunk/gcc/fold-const.c
llvm-gcc-4.2/trunk/gcc/libgcc2.c
llvm-gcc-4.2/trunk/gcc/tree.h
Modified: llvm-gcc-4.2/trunk/gcc/final.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/final.c?rev=54193&r1=54192&r2=54193&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/final.c (original)
+++ llvm-gcc-4.2/trunk/gcc/final.c Tue Jul 29 22:47:56 2008
@@ -255,6 +255,8 @@
static tree get_mem_expr_from_op (rtx, int *);
static void output_asm_operand_names (rtx *, int *, int);
static void output_operand (rtx, int);
+/* APPLE LOCAL ARM compact switch tables */
+static void calculate_alignments (void);
#ifdef LEAF_REGISTERS
static void leaf_renumber_regs (rtx);
#endif
@@ -717,9 +719,13 @@
/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL begin ARM compact switch tables */
+#if !defined (TARGET_EXACT_SIZE_CALCULATIONS)
/* If not optimizing or optimizing for size, don't assign any alignments. */
if (! optimize || optimize_size)
return 0;
+#endif
+/* APPLE LOCAL end ARM compact switch tables */
FOR_EACH_BB (bb)
{
@@ -731,9 +737,14 @@
int log, max_skip, max_log;
/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL begin ARM compact switch tables */
if (!LABEL_P (label)
- || probably_never_executed_bb_p (bb))
+#if !defined (TARGET_EXACT_SIZE_CALCULATIONS)
+ || probably_never_executed_bb_p (bb)
+#endif
+ )
continue;
+/* APPLE LOCAL end ARM compact switch tables */
/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
/* If user has specified an alignment, honour it. */
if (LABEL_ALIGN_LOG (label) > 0)
@@ -834,14 +845,17 @@
int i;
int max_log;
int max_skip;
+ /* APPLE LOCAL begin ARM compact switch tables */
+ /* Removed seq. */
#ifdef HAVE_ATTR_length
#define MAX_CODE_ALIGN 16
- rtx seq;
int something_changed = 1;
char *varying_length;
rtx body;
int uid;
- rtx align_tab[MAX_CODE_ALIGN];
+ /* Removed align_tab. */
+ bool asms_present = false;
+ /* APPLE LOCAL end ARM compact switch tables */
#endif
@@ -949,32 +963,11 @@
varying_length = XCNEWVEC (char, max_uid);
- /* Initialize uid_align. We scan instructions
- from end to start, and keep in align_tab[n] the last seen insn
- that does an alignment of at least n+1, i.e. the successor
- in the alignment chain for an insn that does / has a known
- alignment of n. */
+ /* APPLE LOCAL begin ARM compact switch tables */
uid_align = XCNEWVEC (rtx, max_uid);
+ calculate_alignments ();
- for (i = MAX_CODE_ALIGN; --i >= 0;)
- align_tab[i] = NULL_RTX;
- seq = get_last_insn ();
- for (; seq; seq = PREV_INSN (seq))
- {
- int uid = INSN_UID (seq);
- int log;
-/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
- log = (LABEL_P (seq) ? LABEL_ALIGN_LOG (seq) : 0);
-/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
- uid_align[uid] = align_tab[0];
- if (log)
- {
- /* Found an alignment label. */
- uid_align[uid] = align_tab[log];
- for (i = log - 1; i >= 0; i--)
- align_tab[i] = seq;
- }
- }
+ /* APPLE LOCAL end ARM compact switch tables */
#ifdef CASE_VECTOR_SHORTEN_MODE
if (optimize)
{
@@ -1035,7 +1028,14 @@
#endif /* CASE_VECTOR_SHORTEN_MODE */
/* Compute initial lengths, addresses, and varying flags for each insn. */
- for (insn_current_address = 0, insn = first;
+/* APPLE LOCAL begin ARM compact switch tables */
+#ifdef TARGET_UNEXPANDED_PROLOGUE_SIZE
+ insn_current_address = TARGET_UNEXPANDED_PROLOGUE_SIZE;
+#else
+ insn_current_address = 0;
+#endif
+ for (insn = first;
+/* APPLE LOCAL end ARM compact switch tables */
insn != 0;
insn_current_address += insn_lengths[uid], insn = NEXT_INSN (insn))
{
@@ -1077,7 +1077,12 @@
/* Alignment is handled by ADDR_VEC_ALIGN. */
}
else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
- insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
+ /* APPLE LOCAL begin ARM compact switch tables */
+ {
+ insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
+ asms_present = true;
+ }
+ /* APPLE LOCAL end ARM compact switch tables */
else if (GET_CODE (body) == SEQUENCE)
{
int i;
@@ -1139,7 +1144,14 @@
{
something_changed = 0;
insn_current_align = MAX_CODE_ALIGN - 1;
- for (insn_current_address = 0, insn = first;
+/* APPLE LOCAL begin ARM compact switch tables */
+#ifdef TARGET_UNEXPANDED_PROLOGUE_SIZE
+ insn_current_address = TARGET_UNEXPANDED_PROLOGUE_SIZE;
+#else
+ insn_current_address = 0;
+#endif
+ for (insn = first;
+/* APPLE LOCAL end ARM compact switch tables */
insn != 0;
insn = NEXT_INSN (insn))
{
@@ -1179,6 +1191,11 @@
#ifdef CASE_VECTOR_SHORTEN_MODE
if (optimize && JUMP_P (insn)
+/* APPLE LOCAL begin ARM compact switch tables */
+#ifdef TARGET_EXACT_SIZE_CALCULATIONS
+ && !asms_present
+#endif
+/* APPLE LOCAL end ARM compact switch tables */
&& GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
{
rtx body = PATTERN (insn);
@@ -1280,7 +1297,18 @@
{
insn_lengths[uid]
= (XVECLEN (body, 1) * GET_MODE_SIZE (GET_MODE (body)));
+/* APPLE LOCAL begin ARM compact switch tables */
+#ifdef ADJUST_INSN_LENGTH
+ ADJUST_INSN_LENGTH (insn, insn_lengths[uid]);
+#endif
insn_current_address += insn_lengths[uid];
+#ifdef TARGET_ALIGN_ADDR_DIFF_VEC_LABEL
+ /* Label gets same alignment as table. */
+ SET_LABEL_ALIGN (rel_lab, ADDR_VEC_ALIGN (insn),
+ LABEL_MAX_SKIP (rel_lab));
+ calculate_alignments ();
+#endif
+/* APPLE LOCAL end ARM compact switch tables */
if (insn_lengths[uid] != old_length)
something_changed = 1;
}
@@ -1372,6 +1400,41 @@
#endif /* HAVE_ATTR_length */
}
+/* APPLE LOCAL begin ARM compact switch tables */
+/* Initialize uid_align. We scan instructions
+ from end to start, and keep in align_tab[n] the last seen insn
+ that does an alignment of at least n+1, i.e. the successor
+ in the alignment chain for an insn that does / has a known
+ alignment of n. */
+static void
+calculate_alignments (void)
+{
+ int i;
+ rtx seq;
+ rtx align_tab[MAX_CODE_ALIGN];
+
+ for (i = MAX_CODE_ALIGN; --i >= 0;)
+ align_tab[i] = NULL_RTX;
+ seq = get_last_insn ();
+ for (; seq; seq = PREV_INSN (seq))
+ {
+ int uid = INSN_UID (seq);
+ int log;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+ log = (LABEL_P (seq) ? LABEL_ALIGN_LOG (seq) : 0);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+ uid_align[uid] = align_tab[0];
+ if (log)
+ {
+ /* Found an alignment label. */
+ uid_align[uid] = align_tab[log];
+ for (i = log - 1; i >= 0; i--)
+ align_tab[i] = seq;
+ }
+ }
+}
+/* APPLE LOCAL end ARM compact switch tables */
+
#ifdef HAVE_ATTR_length
/* Given the body of an INSN known to be generated by an ASM statement, return
the number of machine instructions likely to be generated for this insn.
Modified: llvm-gcc-4.2/trunk/gcc/fold-const.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/fold-const.c?rev=54193&r1=54192&r2=54193&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/fold-const.c (original)
+++ llvm-gcc-4.2/trunk/gcc/fold-const.c Tue Jul 29 22:47:56 2008
@@ -1890,7 +1890,9 @@
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
{
/* And some specific cases even faster than that. */
- /* LLVM local begin gcc 121252 */
+ /* LLVM LOCAL - begin gcc 121252 */
+ /* FIXME: Do we need this LLVM-specific code anymore? */
+#ifdef ENABLE_LLVM
if (code == PLUS_EXPR)
{
if (integer_zerop (arg0) && !TREE_OVERFLOW (arg0))
@@ -1908,7 +1910,16 @@
if (integer_onep (arg0) && !TREE_OVERFLOW (arg0))
return arg1;
}
- /* LLVM local end gcc 121252 */
+#else
+ if (code == PLUS_EXPR && integer_zerop (arg0))
+ return arg1;
+ else if ((code == MINUS_EXPR || code == PLUS_EXPR)
+ && integer_zerop (arg1))
+ return arg0;
+ else if (code == MULT_EXPR && integer_onep (arg0))
+ return arg1;
+#endif
+ /* LLVM LOCAL - end gcc 121252 */
/* Handle general case of two integer constants. */
return int_const_binop (code, arg0, arg1, 0);
@@ -2162,6 +2173,8 @@
{
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
+ /* APPLE LOCAL blocks 5862465 */
+ case BLOCK_POINTER_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (arg) == INTEGER_CST)
{
@@ -6833,14 +6846,14 @@
for (;; ref = TREE_OPERAND (ref, 0))
{
+ /* LLVM LOCAL begin */
if (TREE_CODE (ref) == ARRAY_REF
- /* LLVM LOCAL begin */
-#if ENABLE_LLVM
+#ifdef ENABLE_LLVM
/* LLVM extends ARRAY_REF to allow pointers to be the base value. */
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND (ref, 0))) == ARRAY_TYPE)
#endif
- /* LLVM LOCAL end */
)
+ /* LLVM LOCAL end */
{
itype = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (ref, 0)));
if (! itype)
@@ -12951,14 +12964,14 @@
{
if ((TREE_CODE (exp) == INDIRECT_REF
|| TREE_CODE (exp) == ARRAY_REF)
- && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
/* LLVM LOCAL begin */
+ && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
#if ENABLE_LLVM
/* LLVM extends ARRAY_REF to allow pointers to be the base value. */
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == ARRAY_TYPE)
#endif
-/* LLVM LOCAL end */
)
+/* LLVM LOCAL end */
{
tree exp1 = TREE_OPERAND (exp, 0);
tree index;
Modified: llvm-gcc-4.2/trunk/gcc/libgcc2.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libgcc2.c?rev=54193&r1=54192&r2=54193&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/libgcc2.c (original)
+++ llvm-gcc-4.2/trunk/gcc/libgcc2.c Tue Jul 29 22:47:56 2008
@@ -2091,6 +2091,10 @@
#endif
}
+#ifdef __i386__
+extern int VirtualProtect (char *, int, int, int *) __attribute__((stdcall));
+#endif
+
int
mprotect (char *addr, int len, int prot)
{
Modified: llvm-gcc-4.2/trunk/gcc/tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=54193&r1=54192&r2=54193&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree.h (original)
+++ llvm-gcc-4.2/trunk/gcc/tree.h Tue Jul 29 22:47:56 2008
@@ -866,7 +866,8 @@
#define CST_CHECK(T) TREE_CLASS_CHECK (T, tcc_constant)
#define STMT_CHECK(T) TREE_CLASS_CHECK (T, tcc_statement)
#define FUNC_OR_METHOD_CHECK(T) TREE_CHECK2 (T, FUNCTION_TYPE, METHOD_TYPE)
-#define PTR_OR_REF_CHECK(T) TREE_CHECK2 (T, POINTER_TYPE, REFERENCE_TYPE)
+/* APPLE LOCAL blocks 5862465 */
+#define PTR_OR_REF_CHECK(T) TREE_CHECK3 (T, POINTER_TYPE, REFERENCE_TYPE, BLOCK_POINTER_TYPE)
#define RECORD_OR_UNION_CHECK(T) \
TREE_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
More information about the llvm-commits
mailing list