Hello. Following patch introduces just a single helper method, install to HSA branch as r234648.
Thanks, Martin
>From 6d7c765425de3363a8edef2c25572b8208123fb8 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Thu, 31 Mar 2016 11:39:56 +0200 Subject: [PATCH] HSA: introduce append_phi method gcc/ChangeLog: 2016-03-31 Martin Liska <mli...@suse.cz> * hsa-gen.c (hsa_bb::append_phi): New function. (gen_hsa_phi_from_gimple_phi): Use it. * hsa.h: Declare the method. --- gcc/hsa-gen.c | 22 +++++++++++++++------- gcc/hsa.h | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index ef987d2..84dbcf6 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -1766,6 +1766,20 @@ hsa_bb::append_insn (hsa_insn_basic *insn) m_first_insn = insn; } +void +hsa_bb::append_phi (hsa_insn_phi *hphi) +{ + hphi->m_bb = m_bb; + + hphi->m_prev = m_last_phi; + hphi->m_next = NULL; + if (m_last_phi) + m_last_phi->m_next = hphi; + m_last_phi = hphi; + if (!m_first_phi) + m_first_phi = hphi; +} + /* Insert HSA instruction NEW_INSN immediately before an existing instruction OLD_INSN. */ @@ -5761,13 +5775,7 @@ gen_hsa_phi_from_gimple_phi (gimple *phi_stmt, hsa_bb *hbb) } } - hphi->m_prev = hbb->m_last_phi; - hphi->m_next = NULL; - if (hbb->m_last_phi) - hbb->m_last_phi->m_next = hphi; - hbb->m_last_phi = hphi; - if (!hbb->m_first_phi) - hbb->m_first_phi = hphi; + hbb->append_phi (hphi); } /* Constructor of class containing HSA-specific information about a basic diff --git a/gcc/hsa.h b/gcc/hsa.h index 1d6baab..03c0c98 100644 --- a/gcc/hsa.h +++ b/gcc/hsa.h @@ -1056,6 +1056,9 @@ public: /* Append an instruction INSN into the basic block. */ void append_insn (hsa_insn_basic *insn); + /* Add a PHI instruction. */ + void append_phi (hsa_insn_phi *phi); + /* The real CFG BB that this HBB belongs to. */ basic_block m_bb; -- 2.7.1