1 /* brig-label-handler.cc -- brig label directive handling
2    Copyright (C) 2016-2020 Free Software Foundation, Inc.
3    Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com>
4    for General Processor Tech.
5 
6 This file is part of GCC.
7 
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12 
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21 
22 #include "brig-code-entry-handler.h"
23 
24 size_t
operator ()(const BrigBase * base)25 brig_directive_label_handler::operator () (const BrigBase *base)
26 {
27   const BrigDirectiveLabel *brig_label = (const BrigDirectiveLabel *) base;
28 
29   const BrigData *label_name = m_parent.get_brig_data_entry (brig_label->name);
30 
31   std::string label_str ((const char *) (label_name->bytes),
32 			 label_name->byteCount);
33 
34   m_parent.m_cf->start_new_bb ();
35 
36   tree stmt = build_stmt (LABEL_EXPR, m_parent.m_cf->label (label_str));
37   m_parent.m_cf->append_statement (stmt);
38 
39   return base->byteCount;
40 }
41