111
|
1 /* brig-util.h -- gccbrig utility functions
|
|
2 Copyright (C) 2016-2017 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 #ifndef GCC_BRIG_UTIL_H
|
|
23 #define GCC_BRIG_UTIL_H
|
|
24
|
|
25 #include <map>
|
|
26
|
|
27 #include "config.h"
|
|
28 #include "system.h"
|
|
29 #include "ansidecl.h"
|
|
30 #include "coretypes.h"
|
|
31 #include "opts.h"
|
|
32 #include "tree.h"
|
|
33
|
|
34 /* Helper class for keeping book of group variable offsets. */
|
|
35
|
|
36 class group_variable_offset_index
|
|
37 {
|
|
38 public:
|
|
39 group_variable_offset_index () : m_next_group_offset (0) {}
|
|
40
|
|
41 typedef std::map<std::string, size_t> varname_offset_table;
|
|
42
|
|
43 bool has_variable (const std::string &name) const;
|
|
44 void add (const std::string &name, size_t size, size_t alignment);
|
|
45 size_t segment_offset (const std::string &name) const;
|
|
46 size_t size () const { return m_next_group_offset; }
|
|
47
|
|
48 private:
|
|
49 size_t m_next_group_offset;
|
|
50 varname_offset_table m_group_offsets;
|
|
51 };
|
|
52
|
|
53 bool gccbrig_hsa_opcode_op_output_p (BrigOpcode16_t opcode, int opnum);
|
|
54
|
|
55 unsigned gccbrig_hsa_type_bit_size (BrigType16_t t);
|
|
56
|
|
57 uint64_t gccbrig_to_uint64_t (const BrigUInt64 &brig_type);
|
|
58
|
|
59 int gccbrig_reg_size (const BrigOperandRegister *brig_reg);
|
|
60
|
|
61 std::string gccbrig_reg_name (const BrigOperandRegister *reg);
|
|
62
|
|
63 std::string gccbrig_type_name (BrigType16_t type);
|
|
64
|
|
65 std::string gccbrig_segment_name (BrigSegment8_t segment);
|
|
66
|
|
67 bool gccbrig_is_float_type (BrigType16_t type);
|
|
68
|
|
69 bool gccbrig_is_bit_operation (BrigOpcode16_t opcode);
|
|
70
|
|
71 BrigType16_t gccbrig_tree_type_to_hsa_type (tree tree_type);
|
|
72 tree gccbrig_tree_type_for_hsa_type (BrigType16_t brig_type);
|
|
73
|
|
74 bool gccbrig_might_be_host_defined_var_p (const BrigDirectiveVariable *brigVar);
|
|
75
|
|
76 /* From hsa.h. */
|
|
77 bool hsa_type_packed_p (BrigType16_t type);
|
|
78
|
|
79 #endif
|