Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src Pull up following revision(s) (requested by maya in ticke...
details: https://anonhg.NetBSD.org/src/rev/0ff6c8fca527
branches: netbsd-8
changeset: 434935:0ff6c8fca527
user: martin <martin%NetBSD.org@localhost>
date: Wed Apr 18 14:01:16 2018 +0000
description:
Pull up following revision(s) (requested by maya in ticket #775):
tools/Makefile.gnuhost: revision 1.46-1.48
external/gpl3/gcc/dist/gcc/genattrtab.c: revision 1.2
do the bracket nesting only for clang for now.
Use the __clang__ preprocessor symbol to check for clang, since --version
might barf. From joerg@
Apply upstream commit:
From: ppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 27 Apr 2016 21:18:05 +0000
Subject: [PATCH] Reduce nesting of parentheses in conditionals generated by
genattrtab
gcc/ChangeLog:
* genattrtab.c (write_test_expr): New parameter EMIT_PARENS
which defaults to true. Emit an outer pair of parentheses only if
EMIT_PARENS. When continuing a chain of && or || (or & or |),
don't emit parentheses for the right-hand operand.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235536
gcc/arm generates so many parens it hits a bracket depth limited which is
enforced by clang. This reduces the number of parens generated and avoids the
need to increase bracket depth.
Fixes PR toolchain/53178 properly.
Remove hack previously needed to build gcc/arm with clang.
genattrtab.c:1.2 makes this unnecessary.
Tested by thorpej.
diffstat:
external/gpl3/gcc/dist/gcc/genattrtab.c | 33 ++++++++++++++++++++++++---------
tools/Makefile.gnuhost | 6 ++----
2 files changed, 26 insertions(+), 13 deletions(-)
diffs (93 lines):
diff -r b5f977433a08 -r 0ff6c8fca527 external/gpl3/gcc/dist/gcc/genattrtab.c
--- a/external/gpl3/gcc/dist/gcc/genattrtab.c Wed Apr 18 13:51:35 2018 +0000
+++ b/external/gpl3/gcc/dist/gcc/genattrtab.c Wed Apr 18 14:01:16 2018 +0000
@@ -3424,7 +3424,10 @@
/* Given a piece of RTX, print a C expression to test its truth value to OUTF.
We use AND and IOR both for logical and bit-wise operations, so
- interpret them as logical unless they are inside a comparison expression. */
+ interpret them as logical unless they are inside a comparison expression.
+
+ An outermost pair of parentheses is emitted around this C expression unless
+ EMIT_PARENS is false. */
/* Interpret AND/IOR as bit-wise operations instead of logical. */
#define FLG_BITWISE 1
@@ -3440,16 +3443,16 @@
#define FLG_OUTSIDE_AND 8
static unsigned int
-write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags)
+write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags,
+ bool emit_parens = true)
{
int comparison_operator = 0;
RTX_CODE code;
struct attr_desc *attr;
- /* In order not to worry about operator precedence, surround our part of
- the expression with parentheses. */
-
- fprintf (outf, "(");
+ if (emit_parens)
+ fprintf (outf, "(");
+
code = GET_CODE (exp);
switch (code)
{
@@ -3583,8 +3586,18 @@
|| GET_CODE (XEXP (exp, 1)) == EQ_ATTR
|| (GET_CODE (XEXP (exp, 1)) == NOT
&& GET_CODE (XEXP (XEXP (exp, 1), 0)) == EQ_ATTR)))
- attrs_cached
- = write_test_expr (outf, XEXP (exp, 1), attrs_cached, flags);
+ {
+ bool need_parens = true;
+
+ /* No need to emit parentheses around the right-hand operand if we are
+ continuing a chain of && or || (or & or |). */
+ if (GET_CODE (XEXP (exp, 1)) == code)
+ need_parens = false;
+
+ attrs_cached
+ = write_test_expr (outf, XEXP (exp, 1), attrs_cached, flags,
+ need_parens);
+ }
else
write_test_expr (outf, XEXP (exp, 1), attrs_cached,
flags | comparison_operator);
@@ -3802,7 +3815,9 @@
GET_RTX_NAME (code));
}
- fprintf (outf, ")");
+ if (emit_parens)
+ fprintf (outf, ")");
+
return attrs_cached;
}
diff -r b5f977433a08 -r 0ff6c8fca527 tools/Makefile.gnuhost
--- a/tools/Makefile.gnuhost Wed Apr 18 13:51:35 2018 +0000
+++ b/tools/Makefile.gnuhost Wed Apr 18 14:01:16 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.gnuhost,v 1.44.8.1 2018/04/14 10:44:56 martin Exp $
+# $NetBSD: Makefile.gnuhost,v 1.44.8.2 2018/04/18 14:01:16 martin Exp $
#
# Rules used when building a GNU host package. Expects MODULE to be set.
#
@@ -18,13 +18,11 @@
.include <bsd.own.mk>
# Disable use of pre-compiled headers on Darwin.
-# GCC build exceeds the macOS clang default bracket nesting level of 256.
BUILD_OSTYPE!= uname -s
.if ${BUILD_OSTYPE} == "Darwin"
HOST_CFLAGS+=-O2 -no-cpp-precomp
-HOST_CFLAGS+=-O2 -no-cpp-precomp -fbracket-depth=512
-HOST_CXXFLAGS+= -fbracket-depth=512
.endif
+
MAKE_PROGRAM?= ${MAKE}
.for i in 3 2
Home |
Main Index |
Thread Index |
Old Index