diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-02-17 16:16:28 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-02-18 19:00:48 +0000 |
commit | df5ef68888c43ebf19126bdad44c6966c73b70cc (patch) | |
tree | e55be65adb1f7c86d7d4485c802531df02fd0501 /gcc | |
parent | 107674522dbd1a9e63c26ea41ec0e321edac2187 (diff) | |
download | gcc-df5ef68888c43ebf19126bdad44c6966c73b70cc.zip gcc-df5ef68888c43ebf19126bdad44c6966c73b70cc.tar.gz gcc-df5ef68888c43ebf19126bdad44c6966c73b70cc.tar.bz2 |
Add debug interface to GCC debug_tree on GENERIC graphs
This adds in a debugging interface for the backend IR to help diagnose
issues with the tree.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/rust-backend.h | 9 | ||||
-rw-r--r-- | gcc/rust/rust-gcc.cc | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index 0ffc1aa..7fb469b 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -84,6 +84,15 @@ public: {} }; + // debug + virtual void debug (Btype *) = 0; + virtual void debug (Bexpression *) = 0; + virtual void debug (Bstatement *) = 0; + virtual void debug (Bfunction *) = 0; + virtual void debug (Bblock *) = 0; + virtual void debug (Bvariable *) = 0; + virtual void debug (Blabel *) = 0; + // Types. // Produce an error type. Actually the backend could probably just diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 7cec47f..4df813b 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -158,6 +158,14 @@ class Gcc_backend : public Backend public: Gcc_backend (); + void debug (Btype *t) { debug_tree (t->get_tree ()); }; + void debug (Bexpression *t) { debug_tree (t->get_tree ()); }; + void debug (Bstatement *t) { debug_tree (t->get_tree ()); }; + void debug (Bfunction *t) { debug_tree (t->get_tree ()); }; + void debug (Bblock *t) { debug_tree (t->get_tree ()); }; + void debug (Bvariable *t) { debug_tree (t->get_decl ()); }; + void debug (Blabel *t) { debug_tree (t->get_tree ()); }; + // Types. Btype *error_type () { return this->make_type (error_mark_node); } |