aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
AgeCommit message (Collapse)AuthorFilesLines
2020-07-31d: Fix regression, all 32-bit execution tests FAIL: internal error printing ↵Iain Buclaw1-3/+0
module cycle For 32-bit btr(), BIT_NOT_EXPR was being generated twice, something that was not seen with the 64-bit variant. Removed the second call to fix the generated code. gcc/d/ChangeLog: PR d/96393 * intrinsics.cc (expand_intrinsic_bt): Don't generate BIT_NOT_EXPR for btr32 intrinsic.
2020-07-31Daily bump.GCC Administrator1-0/+86
2020-07-30d: Fix associative array literals that don't have alignment holes filledIain Buclaw3-24/+46
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: Add -Wvarargs warning flag to the D front-endIain Buclaw2-0/+10
The D front-end has C-style variadic functions and va_start/va_arg, so it is right to also have warnings for inproper use. gcc/d/ChangeLog: PR d/96154 * gdc.texi (Warnings): Document -Wvarargs. * lang.opt: Add -Wvarargs gcc/testsuite/ChangeLog: PR d/96154 * gdc.dg/pr96154a.d: New test. * gdc.dg/pr96154b.d: New test.
2020-07-30d: Fix ICE in expand_intrinsic_vaargIain Buclaw1-4/+19
Both intrinsics did not handle the case where the va_list object comes from a ref parameter. gcc/d/ChangeLog: PR d/96140 * intrinsics.cc (expand_intrinsic_vaarg): Handle ref parameters as arguments to va_arg(). (expand_intrinsic_vastart): Handle ref parameters as arguments to va_start(). gcc/testsuite/ChangeLog: PR d/96140 * gdc.dg/pr96140.d: New test.
2020-07-30d: Inline bounds checking for simple array assignments.Iain Buclaw1-6/+39
This optimizes the code generation of simple array assignments, inlining the array bounds checking code so there is no reliance on the library routine _d_arraycopy(), which also deals with postblit and copy constructors for non-trivial arrays. gcc/d/ChangeLog: * expr.cc (ExprVisitor::visit (AssignExp *)): Inline bounds checking for simple array assignments. gcc/testsuite/ChangeLog: * gdc.dg/array1.d: New test.
2020-07-30d: Refactor use of built-in memcmp/memcpy/memset into helper functions.Iain Buclaw3-53/+56
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: Move private functions out of ExprVisitor into local staticsIain Buclaw1-154/+159
None of these functions need access to the context pointer of the visitor class, so have been made free standing. gcc/d/ChangeLog: * expr.cc (needs_postblit): Move out of ExprVisitor as a static function. Update all callers. (needs_dtor): Likewise. (lvalue_p): Likewise. (binary_op): Likewise. (binop_assignment): Likewise.
2020-07-30d: Implement core.bitop.rol() and core.bitop.ror() as intrinsics.Iain Buclaw2-0/+61
gcc/d/ChangeLog: * intrinsics.cc (expand_intrinsic_rotate): Add function. (maybe_expand_intrinsic): Handle rol and ror intrinsics. * intrinsics.def (ROL): Add intrinsic. (ROL_TIARG): Add intrinsic. (ROR): Add intrinsic. (ROR_TIARG): Add intrinsic. gcc/testsuite/ChangeLog: * gdc.dg/intrinsics.d: Add ror and rol tests.
2020-07-30d: Refactor matching and lowering of intrinsic functions.Iain Buclaw3-273/+241
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-29Daily bump.GCC Administrator1-0/+4
2020-06-28d: Merge upstream dmd 8508c4e68.Iain Buclaw2-14/+61
Fixes a performance bug where 'static foreach' would take an exponentially long time to expand during CTFE. In the following example: static foreach (i; 0..30000) {} Compilation time had been reduced from around 40 to 0.08 seconds. Memory consumption is also reduced from 3.5GB to 55MB. Reviewed-on: https://github.com/dlang/dmd/pull/11335 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 8508c4e68.
2020-06-26Daily bump.GCC Administrator1-0/+59
2020-06-25d: Do not implicitly set DECL_DECLARED_INLINE_P on member functions.Iain Buclaw1-7/+0
This has been questionable behaviour since it was added, and though it has no effect on wider discussions around what should be the correct semantics of pragma(inline) within D modules, doing this tree-level optimization has mostly zero benefit as cross-module inlining doesn't happen anyway. gcc/d/ChangeLog: * decl.cc (get_symbol_decl): Do not implicitly set DECL_DECLARED_INLINE_P on member functions.
2020-06-25d: Move d_signed_type and d_unsigned_type to types.ccIain Buclaw3-47/+47
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-25d: Merge upstream dmd 4be011355.Iain Buclaw2-45/+55
Fixes self-assignment warnings seen when compiling with clang. Reviewed-on: https://github.com/dlang/dmd/pull/11315 gcc/d/ChangeLog: PR d/95075 * dmd/MERGE: Merge upstream dmd 4be011355.
2020-06-25d: Merge upstream dmd 90450f3ef.Iain Buclaw2-1/+2
Fixes a regression caused by an incomplete backport of converting the Expression semantic pass to a Visitor. Reviewed-on: https://github.com/dlang/dmd/pull/11314 gcc/d/ChangeLog: PR d/95250 * dmd/MERGE: Merge upstream dmd 90450f3ef. gcc/testsuite/ChangeLog: PR d/95250 * gdc.dg/pr95250.d: New test.
2020-06-25d: Remove another dependency on the front-end OutBuffer type.Iain Buclaw1-8/+10
As the DMD front-end never frees allocated memory, the glue layer between the DMD front-end and GCC should generally avoid using DMD types and interfaces if the purpose is internal only. gcc/d/ChangeLog: * d-lang.cc (d_parse_file): Replace OutBuffer with obstack.
2020-06-25d: Merge upstream dmd 5fc1806cd.Iain Buclaw17-227/+224
Backports the OutBuffer interface from upstream dmd master, removing another difference this and the self-hosted D branch that is purely refactoring, and doesn't introduce any mechanical changes. Reviewed-on: https://github.com/dlang/dmd/pull/11302 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 5fc1806cd. * d-lang.cc (d_parse_file): Use peekChars to get string representation of OutBuffer data.
2020-06-25d: Fix ICE in uda_attribute_p when looking up unknown attributeIain Buclaw1-3/+6
The target attribute table is not guaranteed to be set in all backends. gcc/d/ChangeLog: PR d/95173 * d-attribs.cc (uda_attribute_p): Don't search target attribute table if NULL. gcc/testsuite/ChangeLog: PR d/95173 * gdc.dg/pr95173.d: New test.
2020-06-25d: Don't set DECL_INITIAL if initializer is 'void'.Iain Buclaw1-3/+8
Declarations initialized with `= void` were being default initialized. That is not really the intent, and misses the small optimization that should have been gained from using void initializations. gcc/d/ChangeLog: * decl.cc (DeclVisitor::visit (VarDeclaration *)): Don't set DECL_INITIAL if initializer is 'void'. gcc/testsuite/ChangeLog: * gdc.dg/init1.d: New test.
2020-06-25d: Turn on deprecation warnings by default.Iain Buclaw1-1/+1
This is the default in the upstream reference compiler, and can reduce some confusion when comparing warning/error messages of gdc and dmd side by side. Merges libphobos with upstream druntime d05ebaad and phobos 021ae0df7. Reviewed-on: https://github.com/dlang/druntime/pull/3127 https://github.com/dlang/phobos/pull/7521 gcc/d/ChangeLog: * d-lang.cc (d_init_options): Turn on deprecation warnings by default. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime d05ebaad. * src/MERGE: Merge upstream phobos 021ae0df7. * testsuite/libphobos.typeinfo/struct-align.d: Remove empty statement. gcc/testsuite/ChangeLog: * gdc.dg/asm1.d: Don't use deprecated asm syntax. * gdc.dg/compilable.d: Add public to selective import. * gdc.dg/lto/ltotests_0.d: Explicitly catch Throwable. * gdc.dg/runnable.d: Remove empty statement.
2020-06-25d: Merge upstream dmd 4f1046222.Iain Buclaw14-26/+26
Renames OnScopeStatement to ScopeGuardStatement. Reviewed-on: https://github.com/dlang/dmd/pull/11285 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 4f1046222. * toir.cc (IRVisitor::visit (OnScopeGuardStatement *)): Rename to ... (IRVisitor::visit (ScopeGuardStatement *)): ... this.
2020-06-17Daily bump.GCC Administrator1-0/+138
2020-06-16d: Remove names of unused function parameters.Iain Buclaw1-65/+31
gcc/d/ChangeLog: * d-attribs.cc (handle_noreturn_attribute): Remove names of unused function parameters. (handle_leaf_attribute): Likewise. (handle_const_attribute): Likewise. (handle_malloc_attribute): Likewise. (handle_pure_attribute): Likewise. (handle_novops_attribute): Likewise. (handle_nonnull_attribute): Likewise. (handle_nothrow_attribute): Likewise. (handle_type_generic_attribute): Likewise. (handle_transaction_pure_attribute): Likewise. (handle_returns_twice_attribute): Likewise. (handle_fnspec_attribute): Likewise. (handle_always_inline_attribute): Likewise. (d_handle_noinline_attribute): Likewise. (d_handle_forceinline_attribute): Likewise. (d_handle_flatten_attribute): Likewise. (d_handle_noclone_attribute): Likewise. (d_handle_section_attribute): Likewise. (d_handle_alias_attribute): Likewise. (d_handle_weak_attribute): Likewise.
2020-06-16d: Update code formatting in a consistent style.Iain Buclaw18-135/+136
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: Consistently format quotations in comments.Iain Buclaw10-48/+48
gcc/d/ChangeLog: * d-builtins.cc: Update quotation formatting of comments. * d-codegen.cc: Likewise. * d-lang.cc: Likewise. * decl.cc: Likewise. * expr.cc: Likewise. * imports.cc: Likewise. * runtime.cc: Likewise. * toir.cc: Likewise. * typeinfo.cc: Likewise. * types.cc: Likewise.
2020-06-16d: Remove dependency on front-end OutBuffer for diagnostic and deps file ↵Iain Buclaw2-60/+68
generation. gcc/d/ChangeLog: * d-diagnostic.cc (expand_d_format): Replace OutBuffer with obstack. (d_diagnostic_report_diagnostic): Don't free xformat. * d-lang.cc (struct d_option_data): Change deps_target type from OutBuffer to vec <const char *>. (deps_add_target): Update to push each target to deps_target. (deps_write_string): New function. (deps_write): Change buffer type to obstack* and remove colmax. (d_init_options): Update initialization of deps_target. (d_parse_file): Replace OutBuffer with obstack.
2020-06-16d: Remove dependency on front-end File type for json and deps file generation.Iain Buclaw1-10/+32
gcc/d/ChangeLog: * d-lang.cc (d_parse_file): Replace uses of File with FILE.
2020-06-16d: Move generation of array bounds error to own function.Iain Buclaw4-7/+25
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-16d: Use toStringExp instead of explicit castIain Buclaw2-4/+4
gcc/d/ChangeLog: * d-attribs.cc (build_attributes): Use toStringExp instead of cast. * toir.cc (IRVisitor::visit): Likewise.
2020-06-16d: Use new isXxxxExp helpers where possibleIain Buclaw6-41/+46
gcc/d/ChangeLog: * d-attribs.cc (build_attributes): Use isXxxxExp helpers instead of explicit casts. * d-codegen.cc (d_build_call): Likewise. * d-compiler.cc (Compiler::paintAsType): Likewise. * decl.cc (ExprVisitor::visit): Likewise. (layout_class_initializer): Likewise. * expr.cc (ExprVisitor::lvalue_p): Likewise (ExprVisitor::visit): Likewise. * types.cc (layout_aggregate_members): Likewise.
2020-06-16d: Use toTypeFunction instead of explicit castIain Buclaw4-24/+11
gcc/d/ChangeLog: * d-frontend.cc (eval_builtin): Use toTypeFunction instead of cast. * decl.cc (DeclVisitor::visit): Likewise. * toir.cc (IRVisitor::visit): Likewise. * typeinfo.cc (TypeInfoVisitor::visit): Likewise.
2020-06-16d: Use new isTypeXxxx helpers where possible.Iain Buclaw10-120/+82
gcc/d/ChangeLog: * d-builtins.cc (d_eval_constant_expression): Use isTypeXxxx helpers instead of explicit casts. (d_build_builtins_module): Likewise. * d-codegen.cc (get_array_length): Likewise. (identity_compare_p): Likewise. (lower_struct_comparison): Likewise. (build_array_from_val): Likewise. (array_bounds_check): Likewise. (get_function_type): Likewise. (d_build_call): Likewise. * d-compiler.cc (Compiler::paintAsType): Likewise. * d-convert.cc (convert_expr): Likewise. (convert_for_assignment): Likewise. * d-lang.cc (d_classify_record): Likewise. (d_build_eh_runtime_type): Likewise. * decl.cc (DeclVisitor::visit): Likewise. * expr.cc (ExprVisitor::needs_postblit): Likewise. (ExprVisitor::needs_dtor): Likewise. (ExprVisitor::visit): Likewise. * imports.cc (ImportVisitor::visit): Likewise. * typeinfo.cc (get_typeinfo_kind): Likewise. (TypeInfoVisitor::visit): Likewise. (TypeDeclInfoVisitor::visit): Likewise. * types.cc (merge_aggregate_types): Likewise. (TypeVisitor::visit): Likewise.
2020-06-15Daily bump.GCC Administrator1-0/+7
2020-06-14d: Fix line lengths after mechanical field renames.Iain Buclaw2-4/+8
gcc/d/ChangeLog: * expr.cc (ExprVisitor::visit (AssocArrayLiteralExp *)): Fix line lengths, no functional change. * typeinfo.cc (TypeInfoVisitor::layout_interfaces): Likewise. (layout_classinfo_interfaces): Likewise.
2020-06-10Daily bump.GCC Administrator1-0/+15
2020-06-09d: Merge upstream dmd 13d67c575.Iain Buclaw25-57/+843
Reviewed-on: https://github.com/dlang/dmd/pull/11224 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 13d67c575. * d-builtins.cc (build_frontend_type): Update call to TypeVector::create. * d-frontend.cc (Global::_init): Move setting of errorLimit to ... * d-lang.cc (d_init_options): ... here. Update for new field location of errorLimit. (d_post_options): Likewise. * d-port.cc (Port::readwordLE): Update signature. (Port::readwordBE): Likewise. (Port::readlongLE): Likewise. (Port::readlongBE): Likewise. * decl.cc (get_symbol_decl): Update for new field types.
2020-06-09Daily bump.GCC Administrator1-0/+13
2020-06-08d: Fix regression caused by recent refactoringIain Buclaw2-2/+2
gcc/d/ChangeLog: PR d/95573 * dmd/MERGE: Merge upstream dmd 5041e56f1.
2020-06-08d: Merge upstream dmd 955b8b36f.Iain Buclaw12-280/+60
Merges AndAndExp and OrOrExp into a LogicalExp AST node. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 955b8b36f. * expr.cc (ExprVisitor::visit (AndAndExp *)): Rename type to ... (ExprVisitor::visit (LogicalExp *)): ... this. Handle both 'and if' and 'or if' expression nodes. (ExprVisitor::visit (OrOrExp *)): Remove.
2020-06-08Daily bump.GCC Administrator1-0/+40
2020-06-08d: Merge upstream dmd 73d8e2fec.Iain Buclaw24-139/+138
Renames the enum PROTKIND to Prot::Kind, updates all uses of the original enum accordingly. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 73d8e2fec. * decl.cc (get_symbol_decl): Use new Prot::Kind enum. * modules.cc (get_internal_fn): Likewise.
2020-06-07d: Merge upstream dmd 108ca1bcd.Iain Buclaw29-75/+75
Renames OutBuffer::peekString to OutBuffer::peekChars, and OutBuffer::extractString to OutBuffer::extractChars. All callers have been updated as appropriate. Reviewed-on: https://github.com/dlang/dmd/pull/11247 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 108ca1bcd. * d-diagnostic.cc (expand_d_format): Adjust to use extractChars(). * d-frontend.cc (Loc::toChars): Likewise. * d-lang.cc (deps_write): Likewise. (d_parse_file): Likewise. * decl.cc (d_mangle_decl): Likewise. * intrinsics.cc (maybe_set_intrinsic): Likewise.
2020-06-07d: Merge upstream dmd b0df0e982Iain Buclaw34-323/+369
Adds a struct ParameterList to encapulate parameter and vararg information in the front-end. Reviewed-on: https://github.com/dlang/dmd/pull/11226 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd b0df0e982. * d-builtins.cc (build_frontend_type): Use VarArg for varargs_p. * d-codegen.cc (declaration_type): Call TypeFunction::create with argument VARARGnone. (parameter_type): Likewise. (d_build_call): Use new field names and member functions. * d-target.cc (Target::cppParameterType): Call TypeFunction::create with argument VARARGnone. * types.cc (TypeVisitor::visit (TypeFunction *): Use new field names and member functions.
2020-06-07d: Merge upstream dmd 1831b24ff.Iain Buclaw5-19/+13
Converts some global and param fields from pointers to value types. Reviewed-on: https://github.com/dlang/dmd/pull/11245 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 1831b24ff. * d-lang.cc (d_init_options): Remove initialization of updated fields. (d_handle_option): Adjust for new field types.
2020-06-07d: Merge upstream dmd cef1e7991.Iain Buclaw10-52/+70
Adds a DString type, a struct that has a compatible layout with D strings. Many parameters in the Global struct have been switched over to this type, and users of these params have been adjust to use the length or ptr field as appropriate. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd cef1e7991. * d-lang.cc (d_parse_file): Adjust for new field types.
2020-06-06Daily bump.GCC Administrator1-0/+65
2020-06-05d: Merge upstream dmd 740f3d1ea.Iain Buclaw7-41/+55
Backports the conversion of the parameter fields debugids and versionids to Identifiers. The idea is that Identifiers should be used instead of C strings where ever possible. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 740f3d1ea. * d-lang.cc (d_handle_option): Use new fields to save debug and version levels passed over command-line. (d_post_options): Add them to front-end here.
2020-06-05d: Merge upstream dmd f5638c7b8.Iain Buclaw9-71/+87
Adds a CHECKENABLE enum, uses it for all contract parameters for consistency in state checking. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd f5638c7b8. * d-builtins.cc (d_init_versions): Use new CHECKENABLE enum. * d-codegen.cc (array_bounds_check): Likewise. (build_frame_type): Likewise. (get_frameinfo): Likewise. * d-lang.cc (d_init_options): Likewise. (d_init_options_struct): Don't initialize x_flag_bounds_check. (d_handle_option): Use new CHECKENABLE enum. (d_post_options): Likewise. Set flag_bounds_check here. * expr.cc (ExprVisitor::visit(AssertExp *)): Use new CHECKENABLE enum.