aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/d-tree.h
AgeCommit message (Collapse)AuthorFilesLines
2021-04-17d: Add TARGET_D_TEMPLATES_ALWAYS_COMDATIain Buclaw1-1/+0
Following up on the fix for PR99914, when testing on MinGW, it was found not to support weak in the same way as on ELF or Mach-O targets. So the linkage has been reverted back to COMDAT for that target, however in order to properly support overriding functions and variables, all declarations with external linkage must be put on COMDAT. For this a new target hook has been added to control the behavior. gcc/ChangeLog: PR d/99914 * config/i386/winnt-d.c (TARGET_D_TEMPLATES_ALWAYS_COMDAT): Define. * doc/tm.texi: Regenerate. * doc/tm.texi.in (D language and ABI): Add @hook for TARGET_D_TEMPLATES_ALWAYS_COMDAT. gcc/d/ChangeLog: PR d/99914 * d-target.def (d_templates_always_comdat): New hook. * d-tree.h (mark_needed): Remove prototype. * decl.cc: Include d-target.h. (mark_needed): Rename to... (d_mark_needed): ...this. Make static. (set_linkage_for_decl): Put variables in comdat if d_templates_always_comdat.
2021-04-05d: Use weak linkage for template symbols instead of gnu.linkonce (PR99914)Iain Buclaw1-3/+12
The default linkage of templates in the D language is now DECL_WEAK instead of DECL_ONE_ONLY, if supported. This better matches the expected override semantics of template symbols compiled to object code. For example: module rt.config; template rt_flag() { pragma(mangle, "rt_flag") __gshared bool rt_flag = true; } module main; extern(C) __gshared bool rt_flag = false; The above currently does not succeed in linking due to there being multiple definitions of `rt_flag' in different sections that aren't considered mergeable. The compiler flag enabling toggling of this has been given a clearer named `-fweak-templates', which distinguishes itself from G++ `-fweak', which is intended only for testing. gcc/d/ChangeLog: PR d/99914 * d-lang.cc (d_init): Disable flag_weak_templates if no support for weak or one-only symbols. * d-tree.h (VAR_OR_FUNCTION_DECL_CHECK): New macro. (DECL_INSTANTIATED): New macro. (d_comdat_linkage): Remove declaration. (d_linkonce_linkage): Remove declaration. (set_linkage_for_decl): New declaration. * decl.cc (DeclVisitor::visit (StructDeclaration *)): Replace call to d_linkonce_linkage with setting DECL_INSTANTIATED. (DeclVisitor::visit (ClassDeclaration *)): Likewise. (DeclVisitor::visit (EnumDeclaration *)): Likewise. (DeclVisitor::visit (InterfaceDeclaration *)): Remove call to d_linkonce_linkage. (get_symbol_decl): Call set_linkage_for_decl instead of d_linkonce_linkage. (d_finish_decl): Call set_linkage_for_decl. (d_comdat_linkage): Made function static. Only set DECL_COMDAT for DECL_INSTANTIATED decls. (d_linkonce_linkage): Remove function. (d_weak_linkage): New function. (set_linkage_for_decl): New function. * gdc.texi (Runtime Options): Rename -fno-weak to -fno-weak-templates, update documentation of option. * lang.opt (fweak): Rename option to ... (fweak-templates): ... this. Update help string. * modules.cc (get_internal_fn): Add Prot parameter. Set generated function flag. (build_internal_fn): Update call to get_internal_fn. (build_dso_cdtor_fn): Likewise. (register_moduleinfo): Call d_finish_decl on dso_slot_node and dso_initialized_node. * typeinfo.cc (TypeInfoVisitor::internal_reference): Call set_linkage_for_decl instead of d_comdat_linkage. (TypeInfoDeclVisitor::visit (TypeInfoDeclaration *)): Remove calls to d_linkonce_linkage and d_comdat_linkage. (get_cpp_typeinfo_decl): Likewise. gcc/testsuite/ChangeLog: PR d/99914 * gdc.dg/pr99914.d: New test.
2021-02-05d: Remove the expansion of intrinsic and built-in codes from the ↵Iain Buclaw1-1/+1
DEF_D_INTRINSIC macro Instead, the full name of these codes are explicitly given in intrinsics.def, to make it clear what these values map to. gcc/d/ChangeLog: * d-tree.h (DEF_D_INTRINSIC): Don't insert INTRINSIC_ into the intrinsic code name. * intrinsics.cc (DEF_D_INTRINSIC): Don't insert INTRISIC_ and BUILT_IN_ into the intrinsic and built-in code names. * intrinsics.def: Explicitly use full intrinsic and built-in codes in all definitions.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-12-30d: Give the result of evaluated expressions a locationIain Buclaw1-1/+1
CST trees that were converted back to a D front-end AST node lost all location information of the original expression. Now this is propagated on to the literal expression. gcc/d/ChangeLog: * d-tree.h (d_eval_constant_expression): Add location argument. * d-builtins.cc (d_eval_constant_expression): Give generated constants a proper file location. * d-compiler.cc (Compiler::paintAsType): Pass expression location to d_eval_constant_expression. * d-frontend.cc (eval_builtin): Likewise.
2020-08-31d: Fix ICEs in the front-end when pointer size is 16-bit.Iain Buclaw1-1/+1
In the lowering of `bt*' intrinsics, some integer constants had mismatched types, and bitsize was set to the wrong value. In base_vtable_offset, the base offset value was calculated incorrectly. The TypeInfo_Class object is comprised of 18 pointers and 1 uint field, so now the internal classinfo type size is used instead. gcc/d/ChangeLog: * d-target.cc (Target::_init): Don't set classinfosize. * d-tree.h (base_vtable_offset): Move under typeinfo.cc section. * decl.cc (base_vtable_offset): Move to... * typeinfo.cc (base_vtable_offset): ...here. Get base offset from internal TypeInfo_Class type. * intrinsics.cc (expand_intrinsic_bt): Use pointer TYPE_SIZE for setting bitsize value. Build integer constants of correct type.
2020-08-26d: Move d_gimplify_expr and dependencies to d-gimplify.ccIain Buclaw1-0/+3
gcc/d/ChangeLog: * Make-lang.in (D_OBJS): Add d-gimplify.o. * d-lang.cc (empty_modify_p): Move to d-gimplify.cc. (d_gimplify_expr): Likewise. * d-tree.h (d_gimplify_expr): Declare. * d-gimplify.cc: New file.
2020-08-04d: Fix struct literals that have non-deterministic hash values (PR96153)Iain Buclaw1-1/+1
Adds code generation for generating a temporary for, and pre-filling struct and array literals with zeroes before assigning, so that alignment holes don't cause objects to produce a non-deterministic hash value. A new field has been added to the expression visitor to track whether the result is being generated for another literal, so that memset() is only called once on the top-level literal expression, and not for nesting struct or arrays. gcc/d/ChangeLog: PR d/96153 * d-tree.h (build_expr): Add literalp argument. * expr.cc (ExprVisitor): Add literalp_ field. (ExprVisitor::ExprVisitor): Initialize literalp_. (ExprVisitor::visit (AssignExp *)): Call memset() on blits where RHS is a struct literal. Elide assignment if initializer is all zeroes. (ExprVisitor::visit (CastExp *)): Forward literalp_ to generation of subexpression. (ExprVisitor::visit (AddrExp *)): Likewise. (ExprVisitor::visit (ArrayLiteralExp *)): Use memset() to pre-fill object with zeroes. Set literalp in subexpressions. (ExprVisitor::visit (StructLiteralExp *)): Likewise. (ExprVisitor::visit (TupleExp *)): Set literalp in subexpressions. (ExprVisitor::visit (VectorExp *)): Likewise. (ExprVisitor::visit (VectorArrayExp *)): Likewise. (build_expr): Forward literal_p to ExprVisitor. gcc/testsuite/ChangeLog: PR d/96153 * gdc.dg/pr96153.d: New test.
2020-08-03d: Fix ICE using non-local variable: internal compiler error: Segmentation faultIain Buclaw1-0/+1
Moves no frame access error to own function, adding use of it for both when get_framedecl() cannot find a path to the outer function frame, and guarding get_decl_tree() from recursively calling itself. gcc/d/ChangeLog: PR d/96254 * d-codegen.cc (error_no_frame_access): New. (get_frame_for_symbol): Use fdparent name in error message. (get_framedecl): Replace call to assert with error. * d-tree.h (error_no_frame_access): Declare. * decl.cc (get_decl_tree): Detect recursion and error. gcc/testsuite/ChangeLog: PR d/96254 * gdc.dg/pr96254a.d: New test. * gdc.dg/pr96254b.d: New test.
2020-07-30d: Fix associative array literals that don't have alignment holes filledIain Buclaw1-0/+1
Associative array literal keys with alignment holes are now filled using memset() prior to usage, with LTR evaluation of side-effects enforced. gcc/d/ChangeLog: PR d/96152 * d-codegen.cc (build_array_from_exprs): New function. * d-tree.h (build_array_from_exprs): Declare. * expr.cc (ExprVisitor::visit (AssocArrayLiteralExp *)): Use build_array_from_exprs to generate key and value arrays. gcc/testsuite/ChangeLog: PR d/96152 * gdc.dg/pr96152.d: New test.
2020-07-30d: Refactor use of built-in memcmp/memcpy/memset into helper functions.Iain Buclaw1-0/+3
Generating calls to memset, memcpy, and memcmp is frequent enough that it becomes beneficial to put them into their own routine. All parts of the front-end have been updated to call the new helper functions instead of doing it themselves. gcc/d/ChangeLog: * d-codegen.cc (build_memcmp_call): New function. (build_memcpy_call): New function. (build_memset_call): New function. (build_float_identity): Call build_memcmp_call. (lower_struct_comparison): Likewise. (build_struct_comparison): Likewise. * d-tree.h (build_memcmp_call): Declare. (build_memcpy_call): Declare. (build_memset_call): Declare. * expr.cc (ExprVisitor::visit (EqualExp *)): Call build_memcmp_call. (ExprVisitor::visit (AssignExp *)): Call build_memset_call. (ExprVisitor::visit (ArrayLiteralExp *)): Call build_memcpy_call. (ExprVisitor::visit (StructLiteralExp *)): Call build_memset_call.
2020-07-30d: Refactor matching and lowering of intrinsic functions.Iain Buclaw1-1/+1
Intrinsics are now matched explicitly, rather than through a common alias where there are multiple overrides for a common intrinsic. Where there is a corresponding DECL_FUNCTION_CODE, that is now stored in the D intrinsic array. All run-time std.math intrinsics have been removed, as the library implementation already forwards to core.math. gcc/d/ChangeLog: * d-tree.h (DEF_D_INTRINSIC): Rename second argument from A to B. * intrinsics.cc (intrinsic_decl): Add built_in field. (DEF_D_INTRINSIC): Rename second argument from ALIAS to BUILTIN. (maybe_set_intrinsic): Handle new intrinsic codes. (expand_intrinsic_bt): Likewise. (expand_intrinsic_checkedint): Likewise. (expand_intrinsic_bswap): Remove. (expand_intrinsic_sqrt): Remove. (maybe_expand_intrinsic): Group together intrinsic cases that map directly to gcc built-ins. * intrinsics.def (DEF_D_BUILTIN): Rename second argument from A to B. Update all callers to pass equivalent DECL_FUNCTION_CODE. (DEF_CTFE_BUILTIN): Likewise. (STD_COS): Remove intrinsic. (STD_FABS): Remove intrinsic. (STD_LDEXP): Remove intrinsic. (STD_RINT): Remove intrinsic. (STD_RNDTOL): Remove intrinsic. (STD_SIN): Remove intrinsic. (STD_SQRTF): Remove intrinsic. (STD_SQRT): Remove intrinsic. (STD_SQRTL): Remove intrinsic. gcc/testsuite/ChangeLog: * gdc.dg/intrinsics.d: New test.
2020-06-25d: Move d_signed_type and d_unsigned_type to types.ccIain Buclaw1-2/+2
These two functions are not tied to the language-specific part of the front-end in any way. gcc/d/ChangeLog: * d-lang.cc (d_gimplify_expr_p): Make static. (d_parse_file): Likewise. (d_signed_or_unsigned_type): Move to types.cc. (d_unsigned_type): Likewise. (d_signed_type): Likewise. * d-tree.h (d_unsigned_type): Change the location in file. (d_signed_type): Likewise. * types.cc (d_signed_or_unsigned_type): Moved from d-lang.cc. (d_unsigned_type): Likewise. (d_signed_type): Likewise.
2020-06-16d: Update code formatting in a consistent style.Iain Buclaw1-5/+5
gcc/d/ChangeLog: * d-attribs.cc: Update code formatting in a consistant style. * d-builtins.cc: Likewise. * d-codegen.cc: Likewise. * d-compiler.cc: Likewise. * d-convert.cc: Likewise. * d-diagnostic.cc: Likewise. * d-frontend.cc: Likewise. * d-lang.cc: Likewise. * d-longdouble.cc: Likewise. * d-port.cc: Likewise. * d-spec.cc: Likewise. * d-tree.h: Likewise. * decl.cc: Likewise. * expr.cc: Likewise. * longdouble.h: Likewise. * modules.cc: Likewise. * toir.cc: Likewise. * typeinfo.cc: Likewise.
2020-06-16d: Move generation of array bounds error to own function.Iain Buclaw1-0/+1
gcc/d/ChangeLog: * d-codegen.cc (build_array_bounds_call): New function. (build_bounds_condition): Use build_array_bounds_call. * d-lang.cc (d_init_options): Explicitly set default check action to CHECKACTION_D. (d_post_options): Set check action to CHECKACTION_C if the flag -fno-druntime was seen. * d-tree.h (build_array_bounds_call): Declare. * expr.cc (ExprVisitor::visit (AssertExp *)): Use build_array_bounds_call.
2020-06-05d: Merge upstream dmd 56f0a65c4.Iain Buclaw1-0/+1
Updates the Target interface, removing static from all members, so all field accesses and member function calls go through a single global 'target'. Information relating to extern ABI are now in TargetC, TargetCPP, and TargetObjC for each supported language respectively. Reviewed-on: https://github.com/dlang/dmd/pull/11228 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 56f0a65c4. * d-builtins.cc (build_frontend_type): Remove static. (d_build_builtins_module): Use target.va_listType() to get front-end type for va_list. (d_init_builtins): Move creation of va_list to Target::va_listType. * d-codegen.cc (build_interface_binfo): Use new target global. (build_vindex_ref): Likewise. (identity_compare_p): Likewise. * d-ctfloat.cc (CTFloat::parse): Likewise. * d-lang.cc (d_init): Likewise. * d-port.cc (Port::isFloat32LiteralOutOfRange): Likewise. (Port::isFloat64LiteralOutOfRange): Likewise. * d-target.cc (define_float_constants): Initialize constants through a reference, instead of setting globals. (Target::_init): Initialize new fields instead of setting globals. (Target::va_listType): Build front-end type from va_list_type_node. (Target::toCppMangle): Renamed to ... (TargetCPP::toMangle): ... this. (Target::cppTypeInfoMangle): Renamed to ... (TargetCPP::typeInfoMangle): ... this. (Target::cppTypeMangle): Renamed to ... (TargetCPP::typeMangle): this. (Target::cppParameterType): Renamed to ... (TargetCPP::parameterType): ... this. Use target.va_listType() to get front-end type for va_list. (Target::cppFundamentalType): Renamed to ... (TargetCPP::fundamentalType): ... this. * d-tree.h (build_frontend_type): Declare. * decl.cc (base_vtable_offset): Use new target global. * typeinfo.cc (layout_classinfo_interfaces): Likewise. (layout_cpp_typeinfo): Likewise. * types.cc (valist_array_p): Use target.va_listType() to get front-end type for va_list. (layout_aggregate_type): Use new target global.
2020-05-06d: Fix ICE in verify_gimple_stmt, at tree-cfg.c:4959Iain Buclaw1-3/+1
Both array concat and array new expressions wrapped any temporaries created into a BIND_EXPR. This does not work if an expression used to construct the result requires scope destruction, which is represented by a TARGET_EXPR with a clean-up, and a CLEANUP_POINT_EXPR at the location where the temporaries logically go out of scope. The reason for this not working is because the lowering of cleanup point expressions does not traverse inside BIND_EXPRs to expand any gimple cleanup expressions within. The use of creating BIND_EXPR has been removed at both locations, and replaced with a normal temporary variable that has initialization delayed until its address is taken. gcc/d/ChangeLog: PR d/94970 * d-codegen.cc (force_target_expr): Move create_temporary_var implementation inline here. (create_temporary_var): Remove. (maybe_temporary_var): Remove. (bind_expr): Remove. * d-convert.cc (d_array_convert): Use build_local_temp to generate temporaries, and generate its assignment. * d-tree.h (create_temporary_var): Remove. (maybe_temporary_var): Remove. (d_array_convert): Remove vars argument. * expr.cc (ExprVisitor::visit (CatExp *)): Use build_local_temp to generate temporaries, don't wrap them in a BIND_EXPR. (ExprVisitor::visit (NewExp *)): Likewise. gcc/testsuite/ChangeLog: PR d/94970 * gdc.dg/pr94970.d: New test.
2020-04-27d: Fix ICE in assign_temp, at function.c:984 (PR94777)Iain Buclaw1-2/+2
Named arguments were being passed around by invisible reference, just not variadic arguments. There is a need to de-duplicate the routines that handle declaration/parameter promotion and reference checking. However for now, the parameter helper functions have just been renamed to parameter_reference_p and parameter_type, to make it more clear that it is the Parameter equivalent to declaration_reference_p and declaration_type. On writing the tests, a forward-reference bug was discovered on x86_64 during va_list type semantic. This was due to fields not having their parent set-up correctly. gcc/d/ChangeLog: PR d/94777 * d-builtins.cc (build_frontend_type): Set parent for generated fields of built-in types. * d-codegen.cc (argument_reference_p): Rename to ... (parameter_reference_p): ... this. (type_passed_as): Rename to ... (parameter_type): ... this. Make TREE_ADDRESSABLE types restrict. (d_build_call): Move handling of non-POD types here from ... * d-convert.cc (convert_for_argument): ... here. * d-tree.h (argument_reference_p): Rename declaration to ... (parameter_reference_p): ... this. (type_passed_as): Rename declaration to ... (parameter_type): ... this. * types.cc (TypeVisitor::visit (TypeFunction *)): Update caller. gcc/testsuite/ChangeLog: PR d/94777 * gdc.dg/pr94777a.d: New test. * gdc.dg/pr94777b.d: New test.
2020-04-01d: Merge UDAs between function prototype and definitions (PR90136)Iain Buclaw1-4/+2
This change fixes the symbol merging in get_symbol_decl to also consider prototypes. This allows the ability to set user defined attributes on the prototype of a function, which then get applied to the definition, if found later in the compilation. The lowering of UDAs to GCC attributes has been commonized into a single function called apply_user_attributes. gcc/d/ChangeLog: PR d/90136 * d-attribs.cc: Include dmd/attrib.h. (build_attributes): Redeclare as static. (apply_user_attributes): New function. * d-tree.h (class UserAttributeDeclaration): Remove. (build_attributes): Remove. (apply_user_attributes): Declare. (finish_aggregate_type): Remove attrs argument. * decl.cc (get_symbol_decl): Merge declaration prototypes with definitions. Use apply_user_attributes. * modules.cc (layout_moduleinfo_fields): Remove last argument to finish_aggregate_type. * typeinfo.cc (layout_classinfo_interfaces): Likewise. * types.cc (layout_aggregate_members): Likewise. (finish_aggregate_type): Remove attrs argument. (TypeVisitor::visit (TypeEnum *)): Use apply_user_attributes. (TypeVisitor::visit (TypeStruct *)): Remove last argument to finish_aggregate_type. Use apply_user_attributes. (TypeVisitor::visit (TypeClass *)): Likewise. gcc/testsuite/ChangeLog: PR d/90136 * gdc.dg/pr90136a.d: New test. * gdc.dg/pr90136b.d: New test. * gdc.dg/pr90136c.d: New test.
2020-03-20d: Fix SEGV in hash_table<odr_name_hasher, false, ↵Iain Buclaw1-0/+5
xcallocator>::find_slot_with_hash This patch fixes LTO bug with the D front-end. As DECL_ASSEMBLER_NAME is set on the TYPE_DECL, so TYPE_CXX_ODR_P must also be set on the type. The addition of merge_aggregate_types is not strictly needed now, but it fixes a problem introduced in newer versions of the dmd front-end where templated types could be sent more than once to the D code generator. gcc/d/ChangeLog: 2020-03-20 Iain Buclaw <ibuclaw@gdcproject.org> PR lto/91027 * d-tree.h (struct GTY): Add daggregate field. (IDENTIFIER_DAGGREGATE): Define. (d_mangle_decl): Add declaration. * decl.cc (mangle_decl): Remove static linkage, rename to... (d_mangle_decl): ...this, update all callers. * types.cc (merge_aggregate_types): New function. (TypeVisitor::visit (TypeStruct *)): Call merge_aggregate_types, set IDENTIFIER_DAGGREGATE and TYPE_CXX_ODR_P. (TypeVisitor::visit (TypeClass *)): Likewise.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-04-23d: Add support for compiling without libphobos library.Iain Buclaw1-1/+2
Merges upstream dmd 3b3dca8be Reviewed-on: https://github.com/dlang/dmd/pull/9678 gcc/d/ChangeLog: 2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org> * d-builtins.cc (d_init_versions): Add D_BetterC, D_ModuleInfo, D_Exceptions, D_TypeInfo as predefined version conditions. * d-codegen.cc (build_bounds_condition): Generate trap if D asserts are turned off. * d-frontend.cc (getTypeInfoType): Add error when -fno-rtti is set. * d-lang.cc (d_init_options): Initialize new front-end options. (d_handle_option): Handle -fdruntime, -fexceptions, and -frtti. (d_post_options): Turn off D runtime features if -fno-druntime is set. * d-spec.cc (lang_specific_driver): Handle -fdruntime. * d-tree.h (have_typeinfo_p): Add prototype. (build_typeinfo): Update prototype. * decl.cc (DeclVisitor::visit(StructDeclaration)): Create typeinfo only if TypeInfo exists. (DeclVisitor::visit(ClassDeclaration)): Likewise. (DeclVisitor::visit(InterfaceDeclaration)): Likewise. (DeclVisitor::visit(EnumDeclaration)): Likewise. * expr.cc: Update all calls to build_typeinfo. * gdc.texi (Runtime Options): Document -fdruntime and -frtti. * lang.opt: Add -fdruntime and -frtti. * modules.cc (build_module_tree): Create module info only if ModuleInfo exists. * toir.cc (IRVisitor::visit(ThrowStatement)): Update test for -fno-exceptions. * typeinfo.cc (create_tinfo_types): Build internal typeinfo classes only if Object exists. (have_typeinfo_p): New function. (class TypeInfoVisitor): Update all calls to build_typeinfo. (build_typeinfo): Add error when -fno-rtti is set. gcc/testsuite/ChangeLog: 2019-04-23 Iain Buclaw <ibuclaw@gdcproject.org> * gdc.test/fail_compilation/fail2456.d: New test. * gdc.test/fail_compilation/test18312.d: New test. * gdc.test/gdc-test.exp (gdc-convert-args): Handle -betterC. From-SVN: r270518
2019-04-12d: Add -fbuilding-libphobos-tests optionIain Buclaw1-1/+6
Currently, the druntime and phobos unittests are compiled as a separate check program, then ran by the libphobos.unittest/unittest.exp script. As PR d/89255 notes, this process lacks proper multilib handling. As a first step, a new internal option that instructs the compiler to put the reference to all unittest functions in another symbol has been added. This will allow each module to be compiled separately as a standalone program using dg-runtest without running into collisions in the D runtime module registry. gcc/d/ChangeLog: 2019-04-12 Iain Buclaw <ibuclaw@gdcproject.org> * d-tree.h (DECL_IN_UNITTEST_CONDITION_P): Define. * decl.cc (DeclVisitor): Add in_version_unittest_ field. (DeclVisitor::visit(ConditionalDeclaration)): New override. (DeclVisitor::visit(FuncDeclaration)): Set DECL_IN_UNITTEST_CONDITION_P. * lang.opt (-fbuilding-libphobos-tests): Add option. * modules.cc (current_testing_module): New static variable. (build_module_tree): Generate second moduleinfo symbol to hold reference to unittests if flag_building_libphobos_tests. (register_module_decl): Check DECL_IN_UNITTEST_CONDITION_P to decide which moduleinfo the decl should be registered against. From-SVN: r270301
2019-01-20[D] Fix identity comparison for structs with complex float fields.Iain Buclaw1-0/+1
gcc/d/ChangeLog: 2019-01-20 Iain Buclaw <ibuclaw@gdcproject.org> * d-codegen.cc (identity_compare_p): Return false if seen built-in type with padding. (build_float_identity): Moved here from expr.cc. (lower_struct_comparison): Handle real and complex types. * d-tree.h (build_float_identity): New. * expr.cc (build_float_identity): Move to d-codegen.cc. gcc/testsuite/ChangeLog: 2019-01-20 Iain Buclaw <ibuclaw@gdcproject.org> * gdc.dg/runnable.d: Add more tests for comparing complex types. From-SVN: r268104
2019-01-15[D] Move building of typeof(null) values to a common function.Iain Buclaw1-0/+1
gcc/d/ChangeLog: * d-codegen.cc (build_typeof_null_value): New function. * d-tree.h (build_typeof_null_value): Declare. * d-convert.cc (convert_expr): Use build_typeof_null_value. * expr.cc (ExprVisitor::visit(NullExp)): Likewise. From-SVN: r267955
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-10-28Add D front-end, libphobos library, and D2 testsuite.Iain Buclaw1-0/+675
ChangeLog: * Makefile.def (target_modules): Add libphobos. (flags_to_pass): Add GDC, GDCFLAGS, GDC_FOR_TARGET and GDCFLAGS_FOR_TARGET. (dependencies): Make libphobos depend on libatomic, libbacktrace configure, and zlib configure. (language): Add language d. * Makefile.in: Rebuild. * Makefile.tpl (BUILD_EXPORTS): Add GDC and GDCFLAGS. (HOST_EXPORTS): Add GDC. (POSTSTAGE1_HOST_EXPORTS): Add GDC and GDC_FOR_BUILD. (BASE_TARGET_EXPORTS): Add GDC. (GDC_FOR_BUILD, GDC, GDCFLAGS): New variables. (GDC_FOR_TARGET, GDC_FLAGS_FOR_TARGET): New variables. (EXTRA_HOST_FLAGS): Add GDC. (STAGE1_FLAGS_TO_PASS): Add GDC. (EXTRA_TARGET_FLAGS): Add GDC and GDCFLAGS. * config-ml.in: Treat GDC and GDCFLAGS like other compiler/flag environment variables. * configure: Rebuild. * configure.ac: Add target-libphobos to target_libraries. Set and substitute GDC_FOR_BUILD and GDC_FOR_TARGET. config/ChangeLog: * multi.m4: Set GDC. gcc/ChangeLog: * Makefile.in (tm_d_file_list, tm_d_include_list): New variables. (TM_D_H, D_TARGET_DEF, D_TARGET_H, D_TARGET_OBJS): New variables. (tm_d.h, cs-tm_d.h, default-d.o): New rules. (d/d-target-hooks-def.h, s-d-target-hooks-def-h): New rules. (s-tm-texi): Also check timestamp on d-target.def. (generated_files): Add TM_D_H and d-target-hooks-def.h. (build/genhooks.o): Also depend on D_TARGET_DEF. * config.gcc (tm_d_file, d_target_objs, target_has_targetdm): New variables. * config/aarch64/aarch64-d.c: New file. * config/aarch64/aarch64-linux.h (GNU_USER_TARGET_D_CRITSEC_SIZE): Define. * config/aarch64/aarch64-protos.h (aarch64_d_target_versions): New prototype. * config/aarch64/aarch64.h (TARGET_D_CPU_VERSIONS): Define. * config/aarch64/t-aarch64 (aarch64-d.o): New rule. * config/arm/arm-d.c: New file. * config/arm/arm-protos.h (arm_d_target_versions): New prototype. * config/arm/arm.h (TARGET_D_CPU_VERSIONS): Define. * config/arm/linux-eabi.h (EXTRA_TARGET_D_OS_VERSIONS): Define. * config/arm/t-arm (arm-d.o): New rule. * config/default-d.c: New file. * config/glibc-d.c: New file. * config/gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/i386/i386-d.c: New file. * config/i386/i386-protos.h (ix86_d_target_versions): New prototype. * config/i386/i386.h (TARGET_D_CPU_VERSIONS): Define. * config/i386/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS): Define. (GNU_USER_TARGET_D_CRITSEC_SIZE): Define. * config/i386/t-i386 (i386-d.o): New rule. * config/kfreebsd-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/kopensolaris-gnu.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/linux-android.h (ANDROID_TARGET_D_OS_VERSIONS): Define. * config/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/mips/linux-common.h (EXTRA_TARGET_D_OS_VERSIONS): Define. * config/mips/mips-d.c: New file. * config/mips/mips-protos.h (mips_d_target_versions): New prototype. * config/mips/mips.h (TARGET_D_CPU_VERSIONS): Define. * config/mips/t-mips (mips-d.o): New rule. * config/powerpcspe/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/powerpcspe/linux64.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/powerpcspe/powerpcspe-d.c: New file. * config/powerpcspe/powerpcspe-protos.h (rs6000_d_target_versions): New prototype. * config/powerpcspe/powerpcspe.c (rs6000_output_function_epilogue): Support GNU D by using 0 as the language type. * config/powerpcspe/powerpcspe.h (TARGET_D_CPU_VERSIONS): Define. * config/powerpcspe/t-powerpcspe (powerpcspe-d.o): New rule. * config/riscv/riscv-d.c: New file. * config/riscv/riscv-protos.h (riscv_d_target_versions): New prototype. * config/riscv/riscv.h (TARGET_D_CPU_VERSIONS): Define. * config/riscv/t-riscv (riscv-d.o): New rule. * config/rs6000/linux.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/rs6000/linux64.h (GNU_USER_TARGET_D_OS_VERSIONS): Define. * config/rs6000/rs6000-d.c: New file. * config/rs6000/rs6000-protos.h (rs6000_d_target_versions): New prototype. * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Support GNU D by using 0 as the language type. * config/rs6000/rs6000.h (TARGET_D_CPU_VERSIONS): Define. * config/rs6000/t-rs6000 (rs6000-d.o): New rule. * config/s390/s390-d.c: New file. * config/s390/s390-protos.h (s390_d_target_versions): New prototype. * config/s390/s390.h (TARGET_D_CPU_VERSIONS): Define. * config/s390/t-s390 (s390-d.o): New rule. * config/sparc/sparc-d.c: New file. * config/sparc/sparc-protos.h (sparc_d_target_versions): New prototype. * config/sparc/sparc.h (TARGET_D_CPU_VERSIONS): Define. * config/sparc/t-sparc (sparc-d.o): New rule. * config/t-glibc (glibc-d.o): New rule. * configure: Regenerated. * configure.ac (tm_d_file): New variable. (tm_d_file_list, tm_d_include_list, d_target_objs): Add substitutes. * doc/contrib.texi (Contributors): Add self for the D frontend. * doc/frontends.texi (G++ and GCC): Mention D as a supported language. * doc/install.texi (Configuration): Mention libphobos as an option for --enable-shared. Mention d as an option for --enable-languages. (Testing): Mention check-d as a target. * doc/invoke.texi (Overall Options): Mention .d, .dd, and .di as file name suffixes. Mention d as a -x option. * doc/sourcebuild.texi (Top Level): Mention libphobos. * doc/standards.texi (Standards): Add section on D language. * doc/tm.texi: Regenerated. * doc/tm.texi.in: Add @node for D language and ABI, and @hook for TARGET_CPU_VERSIONS, TARGET_D_OS_VERSIONS, and TARGET_D_CRITSEC_SIZE. * dwarf2out.c (is_dlang): New function. (gen_compile_unit_die): Use DW_LANG_D for D. (declare_in_namespace): Return module die for D, instead of adding extra declarations into the namespace. (gen_namespace_die): Generate DW_TAG_module for D. (gen_decl_die): Handle CONST_DECLSs for D. (dwarf2out_decl): Likewise. (prune_unused_types_walk_local_classes): Handle DW_tag_interface_type. (prune_unused_types_walk): Handle DW_tag_interface_type same as other kinds of aggregates. * gcc.c (default_compilers): Add entries for .d, .dd and .di. * genhooks.c: Include d/d-target.def. gcc/po/ChangeLog: * EXCLUDES: Add sources from d/dmd. gcc/testsuite/ChangeLog: * gcc.misc-tests/help.exp: Add D to option descriptions check. * gdc.dg/asan/asan.exp: New file. * gdc.dg/asan/gdc272.d: New test. * gdc.dg/compilable.d: New test. * gdc.dg/dg.exp: New file. * gdc.dg/gdc254.d: New test. * gdc.dg/gdc260.d: New test. * gdc.dg/gdc270a.d: New test. * gdc.dg/gdc270b.d: New test. * gdc.dg/gdc282.d: New test. * gdc.dg/gdc283.d: New test. * gdc.dg/imports/gdc170.d: New test. * gdc.dg/imports/gdc231.d: New test. * gdc.dg/imports/gdc239.d: New test. * gdc.dg/imports/gdc241a.d: New test. * gdc.dg/imports/gdc241b.d: New test. * gdc.dg/imports/gdc251a.d: New test. * gdc.dg/imports/gdc251b.d: New test. * gdc.dg/imports/gdc253.d: New test. * gdc.dg/imports/gdc254a.d: New test. * gdc.dg/imports/gdc256.d: New test. * gdc.dg/imports/gdc27.d: New test. * gdc.dg/imports/gdcpkg256/package.d: New test. * gdc.dg/imports/runnable.d: New test. * gdc.dg/link.d: New test. * gdc.dg/lto/lto.exp: New file. * gdc.dg/lto/ltotests_0.d: New test. * gdc.dg/lto/ltotests_1.d: New test. * gdc.dg/runnable.d: New test. * gdc.dg/simd.d: New test. * gdc.test/gdc-test.exp: New file. * lib/gdc-dg.exp: New file. * lib/gdc.exp: New file. libphobos/ChangeLog: * Makefile.am: New file. * Makefile.in: New file. * acinclude.m4: New file. * aclocal.m4: New file. * config.h.in: New file. * configure: New file. * configure.ac: New file. * d_rules.am: New file. * libdruntime/Makefile.am: New file. * libdruntime/Makefile.in: New file. * libdruntime/__entrypoint.di: New file. * libdruntime/__main.di: New file. * libdruntime/gcc/attribute.d: New file. * libdruntime/gcc/backtrace.d: New file. * libdruntime/gcc/builtins.d: New file. * libdruntime/gcc/config.d.in: New file. * libdruntime/gcc/deh.d: New file. * libdruntime/gcc/libbacktrace.d.in: New file. * libdruntime/gcc/unwind/arm.d: New file. * libdruntime/gcc/unwind/arm_common.d: New file. * libdruntime/gcc/unwind/c6x.d: New file. * libdruntime/gcc/unwind/generic.d: New file. * libdruntime/gcc/unwind/package.d: New file. * libdruntime/gcc/unwind/pe.d: New file. * m4/autoconf.m4: New file. * m4/druntime.m4: New file. * m4/druntime/cpu.m4: New file. * m4/druntime/libraries.m4: New file. * m4/druntime/os.m4: New file. * m4/gcc_support.m4: New file. * m4/gdc.m4: New file. * m4/libtool.m4: New file. * src/Makefile.am: New file. * src/Makefile.in: New file. * src/libgphobos.spec.in: New file. * testsuite/Makefile.am: New file. * testsuite/Makefile.in: New file. * testsuite/config/default.exp: New file. * testsuite/lib/libphobos-dg.exp: New file. * testsuite/lib/libphobos.exp: New file. * testsuite/testsuite_flags.in: New file. From-SVN: r265573