/* Target-dependent code for AMD64.
- Copyright (C) 2001-2021 Free Software Foundation, Inc.
+ Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
static void
amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
{
- /* 1. If the size of an object is larger than two eightbytes, or it has
- unaligned fields, it has class memory. */
- if (TYPE_LENGTH (type) > 16 || amd64_has_unaligned_fields (type))
+ /* 1. If the size of an object is larger than two times eight bytes, or
+ it is a non-trivial C++ object, or it has unaligned fields, then it
+ has class memory.
+
+ It is important that the trivially_copyable check is before the
+ unaligned fields check, as C++ classes with virtual base classes
+ will have fields (for the virtual base classes) with non-constant
+ loc_bitpos attributes, which will cause an assert to trigger within
+ the unaligned field check. As classes with virtual bases are not
+ trivially copyable, checking that first avoids this problem. */
+ if (TYPE_LENGTH (type) > 16
+ || !language_pass_by_reference (type).trivially_copyable
+ || amd64_has_unaligned_fields (type))
{
theclass[0] = theclass[1] = AMD64_MEMORY;
return;
start_pc_sal = find_pc_sect_line (start_pc, NULL, 0);
if (start_pc_sal.symtab == NULL
- || producer_is_gcc_ge_4 (COMPUNIT_PRODUCER
- (SYMTAB_COMPUNIT (start_pc_sal.symtab))) < 6
+ || producer_is_gcc_ge_4 (start_pc_sal.symtab->compunit ()
+ ->producer ()) < 6
|| start_pc_sal.pc != start_pc || pc >= start_pc_sal.end)
return pc;
compilers to emit usable line notes. */
if (post_prologue_pc
&& (cust != NULL
- && COMPUNIT_PRODUCER (cust) != NULL
- && (producer_is_llvm (COMPUNIT_PRODUCER (cust))
- || producer_is_icc_ge_19 (COMPUNIT_PRODUCER (cust)))))
+ && cust->producer () != nullptr
+ && (producer_is_llvm (cust->producer ())
+ || producer_is_icc_ge_19 (cust->producer ()))))
return std::max (start_pc, post_prologue_pc);
}
struct compunit_symtab *cust;
cust = find_pc_compunit_symtab (pc);
- if (cust != NULL && COMPUNIT_EPILOGUE_UNWIND_VALID (cust))
+ if (cust != NULL && cust->epilogue_unwind_valid ())
return 0;
if (target_read_memory (pc, &insn, 1))