This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Updated --with-cpu patch, v12, part 2/3


On Mon, May 12, 2003 at 06:57:27PM -0400, Daniel Jacobowitz wrote:
> This is an update to the --with-cpu patch I posted some months ago.  It's
> evolved and simplified quite a lot, and I think the result is much nicer
> than any previous version.

Oops, didn't get the subject right on part 1...

Here's part two.  Only check $with_cpu for validity on the third pass
through config.gcc.  Otherwise, your i686 host may complain that it
doesn't understand --with-cpu=r5000.... since I've made config.gcc much
stricter in what it checks.

Only the few lines at the beginning and end are real changes.  The rest
is the addition of tabs.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-05-19  Daniel Jacobowitz  <drow@mvista.com>

	* config.gcc: Only process --with-cpu logic in the third pass.

--- config.gcc.half	2003-05-19 15:10:15.000000000 -0400
+++ config.gcc.twothirds	2003-05-19 15:10:01.000000000 -0400
@@ -2113,371 +2113,374 @@ case $machine in
 esac
 
 # Support for --with-cpu and related options (and a few unrelated options,
-# too).
+# too).  Only do this if $machine is the target, or we'll try to validate
+# the CPU argument against the wrong machine type.
 
-case "x$with_cpu" in
-xyes | xno)
-	echo "--with-cpu must be passed a value" 1>&2
-	exit 1
-	;;
-esac
-
-# If there is no $with_cpu option, try to infer one from ${machine}.
-# This block sets nothing except for with_cpu.
-if test x$with_cpu = x
+if test "x$pass2done" = xyes
 then
-	case $machine in
-	ep9312-*-*)
-		# A Cirrus ARM variant.
-		with_cpu="ep9312"
-		;;
-	i486-*-*)
-		with_cpu=i486
-		;;
-	i586-*-*)
-		case $target_alias in
-		k6_2-*)
-			with_cpu=k6-2
+	case "x$with_cpu" in
+	xyes | xno)
+		echo "--with-cpu must be passed a value" 1>&2
+		exit 1
+		;;
+	esac
+
+	# If there is no $with_cpu option, try to infer one from ${machine}.
+	# This block sets nothing except for with_cpu.
+	if test x$with_cpu = x
+	then
+		case $machine in
+		ep9312-*-*)
+			# A Cirrus ARM variant.
+			with_cpu="ep9312"
+			;;
+		i486-*-*)
+			with_cpu=i486
+			;;
+		i586-*-*)
+			case $target_alias in
+			k6_2-*)
+				with_cpu=k6-2
+				;;
+			k6_3-*)
+				with_cpu=k6-3
+				;;
+			k6-*)
+				with_cpu=k6
+				;;
+			pentium_mmx-*|winchip_c6-*|winchip2-*|c3-*)
+				with_cpu=pentium-mmx
+				;;
+			*)
+				with_cpu=pentium
+				;;
+			esac
+			;;
+		i686-*-* | i786-*-*)
+			case $target_alias in
+			k8-*)
+				with_cpu=k8
+				;;
+			athlon_xp-*|athlon_mp-*|athlon_4-*)
+				with_cpu=athlon-4
+				;;
+			athlon_tbird-*|athlon-*)
+				with_cpu=athlon
+				;;
+			pentium2-*)
+				with_cpu=pentium2
+				;;
+			pentium3-*)
+				with_cpu=pentium3
+				;;
+			pentium4-*)
+				with_cpu=pentium4
+				;;
+			*)
+				with_cpu=pentiumpro
+				;;
+			esac
 			;;
-		k6_3-*)
-			with_cpu=k6-3
+		x86_64-*-*)
+			with_cpu=k8
 			;;
-		k6-*)
-			with_cpu=k6
+		alpha*-*-*)
+			case $machine in
+			alphaev6[78]*)
+				with_cpu=ev67
+				;;
+			alphaev6*)
+				with_cpu=ev6
+				;;
+			alphapca56*)
+				with_cpu=pca56
+				;;
+			alphaev56*)
+				with_cpu=ev56
+				;;
+			alphaev5*)
+				with_cpu=ev5
+				;;
+			esac
 			;;
-		pentium_mmx-*|winchip_c6-*|winchip2-*|c3-*)
-			with_cpu=pentium-mmx
-			;;
-		*)
-			with_cpu=pentium
+		sparc*-*-*)
+			with_cpu="`echo $machine | sed 's/-.*$//'`"
 			;;
 		esac
-		;;
-	i686-*-* | i786-*-*)
-		case $target_alias in
-		k8-*)
-			with_cpu=k8
-			;;
-		athlon_xp-*|athlon_mp-*|athlon_4-*)
-			with_cpu=athlon-4
-			;;
-		athlon_tbird-*|athlon-*)
-			with_cpu=athlon
+	fi
+
+	# Similarly for --with-schedule.
+	if test x$with_schedule = x; then
+		case $machine in
+		hppa1* | parisc1*)
+			# Override default PA8000 scheduling model.
+			with_schedule=7100LC
 			;;
-		pentium2-*)
-			with_cpu=pentium2
+		esac
+	fi
+
+	# Optionally, validate the argument to --with-cpu.
+	# This block sets nothing.
+	case $machine in
+	alpha*-*-*)
+		case "x$with_cpu" in
+		x \
+		| xev5 | xev56 | xpca56 | xev6 | xev67)
+			# OK
 			;;
-		pentium3-*)
-			with_cpu=pentium3
+		*)
+			echo "Unknown CPU used in --with-cpu=$with_cpu" 1>&2
+			exit 1
 			;;
-		pentium4-*)
-			with_cpu=pentium4
+		esac
+		;;
+
+	arm*-*-*)
+		case "x$with_cpu" in
+		x \
+		| xarm[236789] | xarm250 | xarm[67][01]0 \
+		| xarm7m | xarm7dm | xarm7dmi | xarm[79]tdmi \
+		| xarm7100 | xarm7500 | xarm7500fe | xarm810 \
+		| xxscale \
+		| xep9312 \
+		| xstrongarm | xstrongarm110 | xstrongarm1100)
+			# OK
 			;;
 		*)
-			with_cpu=pentiumpro
+			echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
+			exit 1
 			;;
 		esac
 		;;
-	x86_64-*-*)
-		with_cpu=k8
-		;;
-	alpha*-*-*)
-		case $machine in
-		alphaev6[78]*)
-			with_cpu=ev67
-			;;
-		alphaev6*)
-			with_cpu=ev6
+
+	hppa*-*-* | parisc*-*-*)
+		case "x$with_schedule" in
+		x | x700 | x7100 | x7100LC | x7200 | x7300 | x8000)
+			# OK
 			;;
-		alphapca56*)
-			with_cpu=pca56
+		*)
+			echo "Unknown processor used in --with-schedule=$with_schedule." 1>&2
+			exit 1
 			;;
-		alphaev56*)
-			with_cpu=ev56
+		esac
+		;;
+
+	i[34567]86-*-* | x86_64-*-*)
+		case x$with_cpu in
+		x \
+		| xi486 \
+		| xi586 | xk6 | xk6-2 | xk6-3 | xpentium-mmx | xpentium \
+		| xpentiumpro | xpentium2 | xpentium3 | xpentium4 \
+		| xathlon | xathlon-4 | xk8)
+			# OK
 			;;
-		alphaev5*)
-			with_cpu=ev5
+		*)
+			echo "Unknown CPU given in --with-cpu=$with_cpu." 1>&2
+			exit 1
 			;;
 		esac
 		;;
-	sparc*-*-*)
-		with_cpu="`echo $machine | sed 's/-.*$//'`"
-		;;
-	esac
-fi
 
-# Similarly for --with-schedule.
-if test x$with_schedule = x; then
-	case $machine in
-	hppa1* | parisc1*)
-		# Override default PA8000 scheduling model.
-		with_schedule=7100LC
+	powerpc*-*-* | rs6000-*-*)
+		case "x$with_cpu" in
+		x \
+		| xcommon \
+		| xpower | xpower2 | xpower3 | xpower4 \
+		| xpowerpc | xpowerpc64 \
+		| xrios | xrios1 | xrios2 | xrsc | xrsc1 | xrs64a \
+		| x401 | x403 | x405 | x405fp | x440 | x440fp | x505 \
+		| x601 | x602 | x603 | x603e | xec603e | x604 \
+		| x604e | x620 | x630 | x740 | x750 | x7400 | x7450 \
+		| x8540 | x801 | x821 | x823 | x860)
+			# OK
+			;;
+		*)
+			echo "Unknown cpu used in --with-cpu=$with_cpu." 1>&2
+			exit 1
+			;;
+		esac
 		;;
-	esac
-fi
 
-# Optionally, validate the argument to --with-cpu.
-# This block sets nothing.
-case $machine in
-alpha*-*-*)
-	case "x$with_cpu" in
-	x \
-	| xev5 | xev56 | xpca56 | xev6 | xev67)
-		# OK
-		;;
-	*)
-		echo "Unknown CPU used in --with-cpu=$with_cpu" 1>&2
-		exit 1
-		;;
-	esac
-	;;
+	sparc*-*-*)
+		case x$with_cpu in
+		x)
+			echo "Should never happen - no default CPU for sparc target."
+			exit 1
+			;;
 
-arm*-*-*)
-	case "x$with_cpu" in
-	x \
-	| xarm[236789] | xarm250 | xarm[67][01]0 \
-	| xarm7m | xarm7dm | xarm7dmi | xarm[79]tdmi \
-	| xarm7100 | xarm7500 | xarm7500fe | xarm810 \
-	| xxscale \
-	| xep9312 \
-	| xstrongarm | xstrongarm110 | xstrongarm1100)
-		# OK
-		;;
-	*)
-		echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
-		exit 1
+		xsparc | xsparc86x | xsparcv9 | xsparc64 \
+		| xsupersparc | xhypersparc | xultrasparc | xv7 | xv8 | xv9)
+			# OK
+			;;
+		*)
+			echo "Unknown cpu used in --with-$which=$val" 1>&2
+			exit 1
+			;;
+		esac
 		;;
-	esac
-	;;
 
-hppa*-*-* | parisc*-*-*)
-	case "x$with_schedule" in
-	x | x700 | x7100 | x7100LC | x7200 | x7300 | x8000)
-		# OK
-		;;
-	*)
-		echo "Unknown processor used in --with-schedule=$with_schedule." 1>&2
-		exit 1
+	v850*-*-*)
+		case "x$with_cpu" in
+		x | xv850e)
+			# OK
+			;;
+		*)
+			echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
+			exit 1
+			;;
+		esac
 		;;
 	esac
-	;;
 
-i[34567]86-*-* | x86_64-*-*)
-	case x$with_cpu in
-	x \
-	| xi486 \
-	| xi586 | xk6 | xk6-2 | xk6-3 | xpentium-mmx | xpentium \
-	| xpentiumpro | xpentium2 | xpentium3 | xpentium4 \
-	| xathlon | xathlon-4 | xk8)
-		# OK
-		;;
-	*)
-		echo "Unknown CPU given in --with-cpu=$with_cpu." 1>&2
-		exit 1
-		;;
-	esac
-	;;
+	# Now, for targets which support this, convert --with-cpu to
+	# a setting of target_cpu_default2.  This block also sets assorted
+	# other configuration variables.
+	target_cpu_default2=
+	case $machine in
+	alpha*-*-*)
+		case $with_cpu in
+			ev67)
+				target_cpu_default2="MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX|MASK_CIX"
+				;;
+			ev6)
+				target_cpu_default2="MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX"
+				;;
+			pca56)
+				target_cpu_default2="MASK_CPU_EV5|MASK_BWX|MASK_MAX"
+				;;
+			ev56)
+				target_cpu_default2="MASK_CPU_EV5|MASK_BWX"
+				;;
+			ev5)
+				target_cpu_default2="MASK_CPU_EV5"
+				;;
+		esac
 
-powerpc*-*-* | rs6000-*-*)
-	case "x$with_cpu" in
-	x \
-	| xcommon \
-	| xpower | xpower2 | xpower3 | xpower4 \
-	| xpowerpc | xpowerpc64 \
-	| xrios | xrios1 | xrios2 | xrsc | xrsc1 | xrs64a \
-	| x401 | x403 | x405 | x405fp | x440 | x440fp | x505 \
-	| x601 | x602 | x603 | x603e | xec603e | x604 \
-	| x604e | x620 | x630 | x740 | x750 | x7400 | x7450 \
-	| x8540 | x801 | x821 | x823 | x860)
-		# OK
-		;;
-	*)
-		echo "Unknown cpu used in --with-cpu=$with_cpu." 1>&2
-		exit 1
+		if test x$gas = xyes
+		then
+			if test "$target_cpu_default2" = ""
+			then
+				target_cpu_default2="MASK_GAS"
+			else
+				target_cpu_default2="${target_cpu_default2}|MASK_GAS"
+			fi
+		fi
 		;;
-	esac
-	;;
 
-sparc*-*-*)
-	case x$with_cpu in
-	x)
-		echo "Should never happen - no default CPU for sparc target."
-		exit 1
-		;;
+	arm*-*-*)
+		case "x$with_cpu" in
+		x)
+			# The most generic
+			target_cpu_default2="TARGET_CPU_generic"
+			;;
 
-	xsparc | xsparc86x | xsparcv9 | xsparc64 \
-	| xsupersparc | xhypersparc | xultrasparc | xv7 | xv8 | xv9)
-		# OK
-		;;
-	*)
-		echo "Unknown cpu used in --with-$which=$val" 1>&2
-		exit 1
+		*)
+			target_cpu_default2="TARGET_CPU_$with_cpu"
+			;;
+		esac
 		;;
-	esac
-	;;
 
-v850*-*-*)
-	case "x$with_cpu" in
-	x | xv850e)
-		# OK
-		;;
-	*)
-		echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
-		exit 1
+	hppa*-*-* | parisc*-*-*)
+		if test x$gas = xyes
+		then
+			target_cpu_default2="MASK_GAS|MASK_JUMP_IN_DELAY"
+		fi
+		if test "x$with_schedule" != x
+		then
+			tm_defines="TARGET_SCHED_DEFAULT=\\\"$with_schedule\\\""
+			;;
+		fi
 		;;
-	esac
-	;;
-esac
 
-# Now, for targets which support this, convert --with-cpu to
-# a setting of target_cpu_default2.  This block also sets assorted
-# other configuration variables.
-
-target_cpu_default2=
-case $machine in
-alpha*-*-*)
-	case $with_cpu in
-		ev67)
-			target_cpu_default2="MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX|MASK_CIX"
-			;;
-		ev6)
-			target_cpu_default2="MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX"
+	i[34567]86-*-* | x86_64-*-*)
+		case x$with_cpu in
+		xathlon-4)
+			target_cpu_default2=TARGET_CPU_DEFAULT_athlon_sse
 			;;
-		pca56)
-			target_cpu_default2="MASK_CPU_EV5|MASK_BWX|MASK_MAX"
+		*)
+			target_cpu_default2=TARGET_CPU_DEFAULT_"`echo $with_cpu | sed s/-/_/`"
 			;;
-		ev56)
-			target_cpu_default2="MASK_CPU_EV5|MASK_BWX"
+		esac
+		;;
+
+	mips*-*-*)
+		case $machine in
+		mips*-*-ecoff* | mips*-*-elf*)
+			if test x$gas = xyes
+			then
+				if test x$gnu_ld = xyes
+				then
+					target_cpu_default2="MASK_GAS|MASK_SPLIT_ADDR"
+				else
+					target_cpu_default2="MASK_GAS"
+				fi
+			fi
 			;;
-		ev5)
-			target_cpu_default2="MASK_CPU_EV5"
+		mips*-*-*)
+			if test x$gas = xyes
+			then
+				target_cpu_default2="MASK_GAS"
+			fi
 			;;
-	esac
-
-	if test x$gas = xyes
-	then
-		if test "$target_cpu_default2" = ""
+		esac
+		case $machine in
+			mips*el-*-*)
+				tm_defines="TARGET_ENDIAN_DEFAULT=0 $tm_defines"
+				;;
+		esac
+		case $tm_file in
+			*mips/elf.h* | *mips/elf64.h*)
+				tm_defines="OBJECT_FORMAT_ELF $tm_defines"
+				;;
+		esac
+		if test "x$enable_gofast" = xyes
 		then
-			target_cpu_default2="MASK_GAS"
+			tm_defines="INIT_SUBTARGET_OPTABS=INIT_GOFAST_OPTABS $tm_defines"
+			tm_file="gofast.h $tm_file"
+			tmake_file="mips/t-gofast $tmake_file"
 		else
-			target_cpu_default2="${target_cpu_default2}|MASK_GAS"
+			tmake_file="mips/t-mips $tmake_file"
 		fi
-	fi
-	;;
-
-arm*-*-*)
-	case "x$with_cpu" in
-	x)
-		# The most generic
-		target_cpu_default2="TARGET_CPU_generic"
-		;;
-
-	*)
-		target_cpu_default2="TARGET_CPU_$with_cpu"
 		;;
-	esac
-	;;
-
-hppa*-*-* | parisc*-*-*)
-	if test x$gas = xyes
-	then
-		target_cpu_default2="MASK_GAS|MASK_JUMP_IN_DELAY"
-	fi
-	if test "x$with_schedule" != x
-	then
-		tm_defines="TARGET_SCHED_DEFAULT=\\\"$with_schedule\\\""
-		;;
-	fi
-	;;
-
-i[34567]86-*-* | x86_64-*-*)
-	case x$with_cpu in
-	xathlon-4)
-		target_cpu_default2=TARGET_CPU_DEFAULT_athlon_sse
-		;;
-	*)
-		target_cpu_default2=TARGET_CPU_DEFAULT_"`echo $with_cpu | sed s/-/_/`"
-		;;
-	esac
-	;;
 
-mips*-*-*)
-	case $machine in
-	mips*-*-ecoff* | mips*-*-elf*)
-		if test x$gas = xyes
+	powerpc*-*-* | rs6000-*-*)
+	        if test x$enable_altivec = xyes
+	        then
+	                tm_file="$tm_file rs6000/altivec-defs.h"
+	        fi
+		if test "x$with_cpu" != x
 		then
-			if test x$gnu_ld = xyes
-			then
-				target_cpu_default2="MASK_GAS|MASK_SPLIT_ADDR"
-			else
-				target_cpu_default2="MASK_GAS"
-			fi
+			target_cpu_default2="\\\"$with_cpu\\\""
 		fi
+		out_file=rs6000/rs6000.c
+		c_target_objs="${c_target_objs} rs6000-c.o"
+		cxx_target_objs="${cxx_target_objs} rs6000-c.o"
+		tmake_file="rs6000/t-rs6000 ${tmake_file}"
 		;;
-	mips*-*-*)
-		if test x$gas = xyes
-		then
-			target_cpu_default2="MASK_GAS"
-		fi
+
+	sparc*-*-*)
+		target_cpu_default2="TARGET_CPU_$with_cpu"
 		;;
-	esac
-	case $machine in
-		mips*el-*-*)
-			tm_defines="TARGET_ENDIAN_DEFAULT=0 $tm_defines"
+
+	v850*-*-*)
+		case "x$with_cpu" in
+		x)
 			;;
-	esac
-	case $tm_file in
-		*mips/elf.h* | *mips/elf64.h*)
-			tm_defines="OBJECT_FORMAT_ELF $tm_defines"
+		xv850e)
+			target_cpu_default2="TARGET_CPU_$with_cpu"
 			;;
-	esac
-	if test "x$enable_gofast" = xyes
-	then
-		tm_defines="INIT_SUBTARGET_OPTABS=INIT_GOFAST_OPTABS $tm_defines"
-		tm_file="gofast.h $tm_file"
-		tmake_file="mips/t-gofast $tmake_file"
-	else
-		tmake_file="mips/t-mips $tmake_file"
-	fi
-	;;
-
-powerpc*-*-* | rs6000-*-*)
-        if test x$enable_altivec = xyes
-        then
-                tm_file="$tm_file rs6000/altivec-defs.h"
-        fi
-	if test "x$with_cpu" != x
-	then
-		target_cpu_default2="\\\"$with_cpu\\\""
-	fi
-	out_file=rs6000/rs6000.c
-	c_target_objs="${c_target_objs} rs6000-c.o"
-	cxx_target_objs="${cxx_target_objs} rs6000-c.o"
-	tmake_file="rs6000/t-rs6000 ${tmake_file}"
-	;;
-
-sparc*-*-*)
-	target_cpu_default2="TARGET_CPU_$with_cpu"
-	;;
-
-v850*-*-*)
-	case "x$with_cpu" in
-	x)
-		;;
-	xv850e)
-		target_cpu_default2="TARGET_CPU_$with_cpu"
+		esac
 		;;
 	esac
-	;;
-esac
 
-if test "$target_cpu_default2" != ""
-then
-	if test "$target_cpu_default" != ""
+	if test "$target_cpu_default2" != ""
 	then
-		target_cpu_default="(${target_cpu_default}|${target_cpu_default2})"
-	else
-		target_cpu_default=$target_cpu_default2
+		if test "$target_cpu_default" != ""
+		then
+			target_cpu_default="(${target_cpu_default}|${target_cpu_default2})"
+		else
+			target_cpu_default=$target_cpu_default2
+		fi
 	fi
 fi
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]