gcc/libgm2/libm2iso
Gaius Mulley 81d5ca0b9b PR 108143/modula2 LONGREAL and powerpc64le-linux
This patch introduces a configure for LONGREAL as float128 when
targetting or hosting cc1gm2 on ppc64le.  It fixes calls to builtins
and fixes the -fdebug-builtins option.

gcc/ChangeLog:

	* doc/gm2.texi (fdebug-builtins): Correct description.

gcc/m2/ChangeLog:

	* Make-lang.in (host_mc_longreal): Detect hosting on powerpc64le
	and if so use __float128 for longreal in mc.
	(MC_ARGS): Append host_mc_longreal.
	* config-make.in (TEST_TARGET_CPU_DEFAULT): New variable.
	(TEST_HOST_CPU_DEFAULT): New variable.
	* configure: Regenerate.
	* configure.ac (M2C_LONGREAL_FLOAT128): New define set if target
	is powerpc64le.
	(M2C_LONGREAL_PPC64LE): New define set if target is powerpc64le.
	* gm2-compiler/M2GCCDeclare.mod: Correct comment case.
	* gm2-compiler/M2GenGCC.mod (MaybeDebugBuiltinAlloca): Call
	SetLastFunction for the builtin function call.
	(MaybeDebugBuiltinMemcpy): Call SetLastFunction for the builtin
	function call.
	(MaybeDebugBuiltinMemset): New procedure function.
	(MakeCopyUse): Use GNU formatting.
	(UseBuiltin): Rewrite to check BuiltinExists.
	(CodeDirectCall): Rewrite to check BuiltinExists and call
	SetLastFunction.
	(CodeMakeAdr): Re-format.
	* gm2-compiler/M2Options.def (SetDebugBuiltins): New procedure.
	* gm2-compiler/M2Options.mod (SetUninitVariableChecking): Allow
	"cond" to switch UninitVariableConditionalChecking separately.
	(SetDebugBuiltins): New procedure.
	* gm2-compiler/M2Quads.def (BuildFunctionCall): Add parameter
	ConstExpr.
	* gm2-compiler/M2Quads.mod (BuildRealProcedureCall): Add parameter
	to BuildRealFuncProcCall.
	(BuildRealFuncProcCall): Add ConstExpr parameter.  Pass ConstExpr
	to BuildFunctionCall.
	(BuildFunctionCall): Add parameter ConstExpr.  Pass ConstExpr to
	BuildRealFunctionCall.
	(BuildConstFunctionCall): Add parameter ConstExpr.  Pass ConstExpr to
	BuildFunctionCall.
	(BuildRealFunctionCall): Add parameter ConstExpr.  Pass ConstExpr to
	BuildRealFuncProcCall.
	* gm2-compiler/P3Build.bnf (SetOrDesignatorOrFunction): Pass FALSE
	to BuildFunctionCall.
	(AssignmentOrProcedureCall): Pass FALSE to BuildFunctionCall.
	* gm2-compiler/SymbolTable.def (IsProcedureBuiltinAvailable): New
	procedure function.
	* gm2-compiler/SymbolTable.mod (CanUseBuiltin): New procedure
	function.
	(IsProcedureBuiltinAvailable): New procedure function.
	* gm2-gcc/m2builtins.cc (DEBUGGING): Undef.
	(bf_category): New enum type.
	(struct builtin_function_entry): New field function_avail.
	(m2builtins_BuiltInMemCopy): Rename from ...
	(m2builtins_BuiltinMemCopy): ... this.
	(DoBuiltinMemSet): New function.
	(m2builtins_BuiltinMemSet): New function.
	(do_target_support_exists): New function.
	(target_support_exists): New function.
	(m2builtins_BuiltinExists): Return true or false.
	(m2builtins_BuildBuiltinTree): Rename local variables.
	Replace long_double_type_node with GetM2LongRealType.
	(m2builtins_init): Use GetM2LongRealType rather than
	long_double_type_node.
	* gm2-gcc/m2builtins.def (BuiltInMemCopy): Rename to ...
	(BuiltinMemCopy): ... this.
	(BuiltinMemSet): New procedure function.
	* gm2-gcc/m2builtins.h (m2builtins_BuiltInMemCopy): Rename to ...
	(m2builtins_BuiltinMemCopy): ... this.
	(m2builtins_BuiltinMemSet): New procedure function.
	* gm2-gcc/m2configure.cc (m2configure_M2CLongRealFloat128): New
	procedure function.
	(m2configure_M2CLongRealIBM128): New procedure function.
	(m2configure_M2CLongRealLongDouble): New procedure function.
	(m2configure_M2CLongRealLongDoublePPC64LE): New procedure function.
	* gm2-gcc/m2configure.def (M2CLongRealFloat128): New procedure function.
	(M2CLongRealIBM128): New procedure function.
	(M2CLongRealLongDouble): New procedure function.
	(M2CLongRealLongDoublePPC64LE): New procedure function.
	* gm2-gcc/m2configure.h (m2configure_FullPathCPP): New procedure function.
	(m2configure_M2CLongRealFloat128): New procedure function.
	(m2configure_M2CLongRealIBM128): New procedure function.
	(m2configure_M2CLongRealLongDouble): New procedure function.
	(m2configure_M2CLongRealLongDoublePPC64LE): New procedure function.
	* gm2-gcc/m2convert.cc (m2convert_BuildConvert): Use convert_loc.
	* gm2-gcc/m2options.h (M2Options_SetDebugBuiltins): New function.
	* gm2-gcc/m2statement.cc (m2statement_BuildAssignmentTree): Set
	TREE_USED to true.
	(m2statement_BuildGoto):Set TREE_USED to true.
	(m2statement_BuildParam): Set TREE_USED to true.
	(m2statement_BuildBuiltinCallTree): New function.
	(m2statement_BuildFunctValue): Set TREE_USED to true.
	* gm2-gcc/m2statement.def (BuildBuiltinCallTree): New procedure function.
	* gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): New
	procedure function.
	* gm2-gcc/m2treelib.cc (m2treelib_DoCall0): Remove spacing.
	(m2treelib_DoCall1): Remove spacing.
	(m2treelib_DoCall2): Remove spacing.
	(m2treelib_DoCall3): Remove spacing.
	(add_stmt): Rename parameter.
	* gm2-gcc/m2type.cc (build_set_type): Remove spacing.
	(build_m2_specific_size_type): Remove spacing.
	(finish_build_pointer_type): Remove spacing.
	(m2type_BuildVariableArrayAndDeclare): Remove spacing.
	(build_m2_short_real_node): Remove spacing.
	(build_m2_real_node): Remove spacing.
	(build_m2_long_real_node): Use float128_type_node if
	M2CLongRealFloat128 is set.
	(build_m2_ztype_node): Remove spacing.
	(build_m2_long_int_node): Remove spacing.
	(build_m2_long_card_node): Remove spacing.
	(build_m2_short_int_node): Remove spacing.
	(build_m2_short_card_node): Remove spacing.
	(build_m2_iso_loc_node): Remove spacing.
	(m2type_SameRealType): New function.
	(m2type_InitBaseTypes): Create m2_c_type_node using
	m2_long_complex_type_node.
	(m2type_SetAlignment): Tidy up comment.
	* gm2-gcc/m2type.def (SameRealType):  New procedure function.
	* gm2-gcc/m2type.h (m2type_SameRealType): New procedure function.
	* gm2-lang.cc (gm2_langhook_type_for_mode): Build long complex
	node from m2 language specific long double node.
	* gm2-libs-log/RealConversions.mod (IsNan): New procedure
	function.
	(doPowerOfTen): Re-implement.
	* gm2-libs/Builtins.mod: Add newline.
	* gm2-libs/DynamicStrings.def (ReplaceChar): New procedure function.
	* gm2-libs/DynamicStrings.mod (ReplaceChar): New procedure function.
	* gm2config.aci.in (M2C_LONGREAL_FLOAT128): New config value.
	(M2C_LONGREAL_PPC64LE): New config value.
	* gm2spec.cc (lang_specific_driver): New local variable
	need_default_mabi set to default value depending upon
	M2C_LONGREAL_PPC64LE and M2C_LONGREAL_FLOAT128.
	* lang.opt (Wcase-enum): Moved to correct section.
	* m2pp.cc (m2pp_real_type): New function.
	(m2pp_type): Call m2pp_real_type.
	(m2pp_print_mode): New function.
	(m2pp_simple_type): Call m2pp_simple_type.
	(m2pp_float): New function.
	(m2pp_expression): Call m2pp_float.
	* mc-boot/GDynamicStrings.cc: Rebuild.
	* mc-boot/GDynamicStrings.h: Rebuild.
	* mc-boot/GFIO.cc: Rebuild.
	* mc-boot/GFIO.h: Rebuild.
	* mc-boot/GIO.cc: Rebuild.
	* mc-boot/GRTint.cc: Rebuild.
	* mc-boot/Gdecl.cc: Rebuild.
	* mc-boot/GmcOptions.cc: Rebuild.
	* mc-boot/GmcOptions.h: Rebuild.
	* mc/decl.mod: Rebuild.
	* mc/mcOptions.def (getCRealType): New procedure function.
	(getCLongRealType): New procedure function.
	(getCShortRealType): New procedure function.
	* mc/mcOptions.mod (getCRealType): New procedure function.
	(getCLongRealType): New procedure function.
	(getCShortRealType): New procedure function.

libgm2/ChangeLog:

	* Makefile.am (TARGET_LONGDOUBLE_ABI): New variable set to
	-mabi=ieeelongdouble if the target is powerpc64le.
	(AM_MAKEFLAGS): Append TARGET_LONGDOUBLE_ABI.
	* Makefile.in: Rebuild.
	* libm2cor/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
	TARGET_LONGDOUBLE_ABI.
	(libm2cor_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
	(libm2cor_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
	* libm2cor/Makefile.in: Rebuild.
	* libm2iso/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
	TARGET_LONGDOUBLE_ABI.
	(libm2iso_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
	(libm2iso_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
	* libm2iso/Makefile.in: Rebuild.
	* libm2log/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
	TARGET_LONGDOUBLE_ABI.
	(libm2log_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
	(libm2log_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
	* libm2log/Makefile.in: Rebuild.
	* libm2min/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
	TARGET_LONGDOUBLE_ABI.
	(libm2min_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
	(libm2min_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
	* libm2min/Makefile.in: Rebuild.
	* libm2pim/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and
	TARGET_LONGDOUBLE_ABI.
	(libm2pim_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI.
	(libm2pim_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI.
	* libm2pim/Makefile.in: Rebuild.

gcc/testsuite/ChangeLog:

	* gm2/extensions/pass/libc.def: Add spacing.
	* gm2/pimlib/logitech/run/pass/realconv.mod: Add debugging print.
	* gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp:
	Add -fdebug-builtins flag.
	* lib/gm2.exp (gm2_target_compile_default): Add
	-mabi=ieeelongdouble if the target is powerpc.
	(gm2_link_flags): Add
	-mabi=ieeelongdouble if the target is powerpc.
	* gm2/pim/intrinsic/run/pass/cstub.c: New test.
	* gm2/pim/intrinsic/run/pass/cstub.def: New test.
	* gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp: New test.
	* gm2/pim/intrinsic/run/pass/test.mod: New test.
	* gm2/pim/run/pass/builtins.mod: New test.
	* gm2/pim/run/pass/convert1.mod: New test.
	* gm2/pim/run/pass/longint1.mod: New test.
	* gm2/pim/run/pass/longint2.mod: New test.
	* gm2/pim/run/pass/longint3.mod: New test.
	* gm2/pim/run/pass/longint4.mod: New test.
	* gm2/pim/run/pass/longint5.mod: New test.
	* gm2/pim/run/pass/longint6.mod: New test.
	* gm2/pim/run/pass/longint7.mod: New test.
	* gm2/pim/run/pass/longint8.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-19 19:23:03 +01:00
..
ChanConsts.h
ErrnoCategory.cc PR 109125 Modula2 SIGBUS in m2pim_ldtoa_ldtoa 2023-03-14 19:52:11 +00:00
m2rts.h PR 107630 runtime libs should be self-contained 2023-03-16 20:34:32 +00:00
Makefile.am PR 108143/modula2 LONGREAL and powerpc64le-linux 2023-09-19 19:23:03 +01:00
Makefile.in PR 108143/modula2 LONGREAL and powerpc64le-linux 2023-09-19 19:23:03 +01:00
RTco.cc Replace bool as boolean instead of int in libgm2 2023-05-13 15:49:50 +01:00
wrapclock.cc PR modula2/110779 SysClock can not read the clock (Darwin portability fixes) 2023-08-12 18:17:41 +01:00
wrapsock.c PR 109125 Modula2 SIGBUS in m2pim_ldtoa_ldtoa 2023-03-14 19:52:11 +00:00
wraptime.cc PR modula2/110779 SysClock can not read the clock 2023-08-05 17:35:12 +01:00