From: Mark Wielaard <mjw@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: Jason Merrill <jason@redhat.com>,
Cary Coutant <ccoutant@google.com>,
"Joseph S. Myers" <joseph@codesourcery.com>,
Mark Wielaard <mjw@redhat.com>
Subject: [PATCH 1/2] DWARFv5 Emit DW_TAG_atomic_type.
Date: Tue, 12 Aug 2014 15:35:00 -0000 [thread overview]
Message-ID: <1407857735-18515-1-git-send-email-mjw@redhat.com> (raw)
Ping. This patch is based on the proposed patches to support the
restrict type. But isn't meant to be integrated at this time. DWARFv5
is still only a collection of proposals and hasn't seen any draft
yet. But feedback is highly appreciated. Also if there are tips on how
(and where) to maintain an experimental patch set for a future standard
that would be welcome.
There is a corresponding patch for GDB:
https://sourceware.org/ml/gdb-patches/2014-06/msg00795.html
gcc/ChangeLog
PR debug/60782
* dwarf2out.c (modified_type_die): Handle TYPE_QUAL_ATOMIC.
* opts.c (common_handle_option): Accept -gdwarf-5.
gcc/testsuite/ChangeLog
PR debug/60782
* gcc.dg/guality/atomic.c: New test.
include/ChangeLog
PR debug/60782
* dwarf2.def: Add DWARFv5 DW_TAG_atomic_type.
---
gcc/ChangeLog | 6 ++++++
gcc/dwarf2out.c | 22 +++++++++++++++++++---
gcc/opts.c | 2 +-
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/gcc.dg/guality/atomic.c | 13 +++++++++++++
include/ChangeLog | 5 +++++
include/dwarf2.def | 2 ++
7 files changed, 51 insertions(+), 4 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/guality/atomic.c
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 428a1e1..1adf6a6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-09 Mark Wielaard <mjw@redhat.com>
+
+ PR debug/60782
+ * dwarf2out.c (modified_type_die): Handle TYPE_QUAL_ATOMIC.
+ * opts.c (common_handle_option): Accept -gdwarf-5.
+
2014-07-08 Mark Wielaard <mjw@redhat.com>
PR debug/59051
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 51e379e..7792604 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10478,7 +10478,8 @@ modified_type_die (tree type, int cv_quals, dw_die_ref context_die)
return NULL;
/* Only these cv-qualifiers are currently handled. */
- cv_quals &= (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT);
+ cv_quals &= (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT
+ | TYPE_QUAL_ATOMIC);
/* Don't emit DW_TAG_restrict_type for DWARFv2, since it is a type
tag modifier (and not an attribute) old consumers won't be able
@@ -10486,6 +10487,10 @@ modified_type_die (tree type, int cv_quals, dw_die_ref context_die)
if (dwarf_version < 3)
cv_quals &= ~TYPE_QUAL_RESTRICT;
+ /* Likewise for DW_TAG_atomic_type for DWARFv5. */
+ if (dwarf_version < 5)
+ cv_quals &= ~TYPE_QUAL_ATOMIC;
+
/* See if we already have the appropriately qualified variant of
this type. */
qualified_type = get_qualified_type (type, cv_quals);
@@ -10529,7 +10534,8 @@ modified_type_die (tree type, int cv_quals, dw_die_ref context_die)
else
{
int dquals = TYPE_QUALS_NO_ADDR_SPACE (dtype);
- dquals &= (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT);
+ dquals &= (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT
+ | TYPE_QUAL_ATOMIC);
if ((dquals & ~cv_quals) != TYPE_UNQUALIFIED
|| (cv_quals == dquals && DECL_ORIGINAL_TYPE (name) != type))
/* cv-unqualified version of named type. Just use
@@ -10564,12 +10570,22 @@ modified_type_die (tree type, int cv_quals, dw_die_ref context_die)
sub_die = modified_type_die (type, cv_quals & ~TYPE_QUAL_VOLATILE,
context_die);
}
- else if (cv_quals & TYPE_QUAL_RESTRICT)
+ else if ((cv_quals & TYPE_QUAL_RESTRICT)
+ && (((cv_quals & ~TYPE_QUAL_RESTRICT) == TYPE_UNQUALIFIED)
+ || get_qualified_type (type, cv_quals) == NULL_TREE
+ || (get_qualified_type (type, cv_quals & ~TYPE_QUAL_RESTRICT)
+ != NULL_TREE)))
{
mod_type_die = new_die (DW_TAG_restrict_type, mod_scope, type);
sub_die = modified_type_die (type, cv_quals & ~TYPE_QUAL_RESTRICT,
context_die);
}
+ else if (cv_quals & TYPE_QUAL_ATOMIC)
+ {
+ mod_type_die = new_die (DW_TAG_atomic_type, mod_scope, type);
+ sub_die = modified_type_die (type, cv_quals & ~TYPE_QUAL_ATOMIC,
+ context_die);
+ }
else if (code == POINTER_TYPE)
{
mod_type_die = new_die (DW_TAG_pointer_type, mod_scope, type);
diff --git a/gcc/opts.c b/gcc/opts.c
index be1867c..f3f2817 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1884,7 +1884,7 @@ common_handle_option (struct gcc_options *opts,
/* FALLTHRU */
case OPT_gdwarf_:
- if (value < 2 || value > 4)
+ if (value < 2 || value > 5)
error_at (loc, "dwarf version %d is not supported", value);
else
opts->x_dwarf_version = value;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3f9e53f..4c8ce92 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-09 Mark Wielaard <mjw@redhat.com>
+
+ PR debug/60782
+ * gcc.dg/guality/atomic.c: New test.
+
2014-07-08 Mark Wielaard <mjw@redhat.com>
PR debug/59051
diff --git a/gcc/testsuite/gcc.dg/guality/atomic.c b/gcc/testsuite/gcc.dg/guality/atomic.c
new file mode 100644
index 0000000..c76cfa4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/atomic.c
@@ -0,0 +1,13 @@
+/* debuginfo tests for the _Atomic type qualifier. */
+/* { dg-do run } */
+/* { dg-options "-std=c11 -gdwarf-5" } */
+
+volatile _Atomic int * const _Atomic hwaddr = (void *) 0x1234;
+
+int
+main (int argc, char **argv)
+{
+ return hwaddr == (void *) argv[0];
+}
+
+/* { dg-final { gdb-test 10 "type:hwaddr" "volatile _Atomic int * const _Atomic" } } */
diff --git a/include/ChangeLog b/include/ChangeLog
index 1cda0dc..2609e70 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-09 Mark Wielaard <mjw@redhat.com>
+
+ PR debug/60782
+ * dwarf2.def: Add DWARFv5 DW_TAG_atomic_type.
+
2014-06-10 Thomas Schwinge <thomas@codesourcery.com>
PR lto/61334
diff --git a/include/dwarf2.def b/include/dwarf2.def
index 71a37b3..6490391 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -133,6 +133,8 @@ DW_TAG (DW_TAG_shared_type, 0x40)
DW_TAG (DW_TAG_type_unit, 0x41)
DW_TAG (DW_TAG_rvalue_reference_type, 0x42)
DW_TAG (DW_TAG_template_alias, 0x43)
+/* DWARF 5. */
+DW_TAG (DW_TAG_atomic_type, 0x47) /* NOT AN OFFICIAL NUMBER. DWARF5 131112.1 */
DW_TAG_DUP (DW_TAG_lo_user, 0x4080)
DW_TAG_DUP (DW_TAG_hi_user, 0xffff)
--
1.8.3.1
next reply other threads:[~2014-08-12 15:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 15:35 Mark Wielaard [this message]
2014-08-12 15:36 ` [PATCH 2/2] DWARF5: Add DW_TAG_aligned_type support Mark Wielaard
2014-08-12 20:05 ` Jason Merrill
2014-08-12 19:32 ` [PATCH 1/2] DWARFv5 Emit DW_TAG_atomic_type Jason Merrill
-- strict thread matches above, loose matches on Subject: below --
2014-07-08 16:39 [PATCH 1/2] dwarf2out.c: Pass one cv_quals argument instead of two for const and volatile Mark Wielaard
2014-07-09 21:36 ` [PATCH 1/2] DWARFv5 Emit DW_TAG_atomic_type Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1407857735-18515-1-git-send-email-mjw@redhat.com \
--to=mjw@redhat.com \
--cc=ccoutant@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).