Mercurial > hg > CbC > CbC_gcc
comparison gcc/brig/brigfrontend/brig-util.h @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* brig-util.h -- gccbrig utility functions | 1 /* brig-util.h -- gccbrig utility functions |
2 Copyright (C) 2016-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2016-2018 Free Software Foundation, Inc. |
3 Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com> | 3 Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com> |
4 for General Processor Tech. | 4 for General Processor Tech. |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
21 | 21 |
22 #ifndef GCC_BRIG_UTIL_H | 22 #ifndef GCC_BRIG_UTIL_H |
23 #define GCC_BRIG_UTIL_H | 23 #define GCC_BRIG_UTIL_H |
24 | 24 |
25 #include <map> | 25 #include <map> |
26 #include <vector> | |
26 | 27 |
27 #include "config.h" | 28 #include "config.h" |
28 #include "system.h" | 29 #include "system.h" |
29 #include "ansidecl.h" | 30 #include "ansidecl.h" |
30 #include "coretypes.h" | 31 #include "coretypes.h" |
31 #include "opts.h" | 32 #include "opts.h" |
32 #include "tree.h" | 33 #include "tree.h" |
34 | |
35 /* There are 128 c regs and 2048 s/d/q regs each in the HSAIL. */ | |
36 #define BRIG_2_TREE_HSAIL_C_REG_COUNT (128) | |
37 #define BRIG_2_TREE_HSAIL_S_REG_COUNT (2048) | |
38 #define BRIG_2_TREE_HSAIL_D_REG_COUNT (2048) | |
39 #define BRIG_2_TREE_HSAIL_Q_REG_COUNT (2048) | |
40 #define BRIG_2_TREE_HSAIL_TOTAL_REG_COUNT \ | |
41 (BRIG_2_TREE_HSAIL_C_REG_COUNT + BRIG_2_TREE_HSAIL_S_REG_COUNT \ | |
42 + BRIG_2_TREE_HSAIL_D_REG_COUNT + BRIG_2_TREE_HSAIL_Q_REG_COUNT) | |
33 | 43 |
34 /* Helper class for keeping book of group variable offsets. */ | 44 /* Helper class for keeping book of group variable offsets. */ |
35 | 45 |
36 class group_variable_offset_index | 46 class group_variable_offset_index |
37 { | 47 { |
74 bool gccbrig_might_be_host_defined_var_p (const BrigDirectiveVariable *brigVar); | 84 bool gccbrig_might_be_host_defined_var_p (const BrigDirectiveVariable *brigVar); |
75 | 85 |
76 /* From hsa.h. */ | 86 /* From hsa.h. */ |
77 bool hsa_type_packed_p (BrigType16_t type); | 87 bool hsa_type_packed_p (BrigType16_t type); |
78 | 88 |
89 struct reg_use_info | |
90 { | |
91 /* This vector keeps count of the times an HSAIL register is used as | |
92 a tree type in generic expressions. The count is used to select | |
93 type for 'register' variables to reduce emission of | |
94 VIEW_CONVERT_EXPR nodes. The data is kept in vector (insertion | |
95 order) for determinism, in a case there is a tie with the | |
96 counts. */ | |
97 std::vector<std::pair<tree, size_t> > m_type_refs; | |
98 /* Tree to index. Lookup for the above vector. */ | |
99 std::map<tree, size_t> m_type_refs_lookup; | |
100 }; | |
101 | |
102 /* key = hsa register entry generated by gccbrig_hsa_reg_id (). */ | |
103 typedef std::map<size_t, reg_use_info> regs_use_index; | |
104 | |
105 size_t gccbrig_hsa_reg_id (const BrigOperandRegister ®); | |
106 std::string gccbrig_hsa_reg_name_from_id (size_t reg_hash); | |
107 | |
108 void gccbrig_print_reg_use_info (FILE *dump, const regs_use_index &info); | |
109 | |
110 /* Return the number of elements in a VECTOR_TYPE. BRIG does not support | |
111 variable-length vectors. */ | |
112 inline unsigned HOST_WIDE_INT | |
113 gccbrig_type_vector_subparts (const_tree type) | |
114 { | |
115 return TYPE_VECTOR_SUBPARTS (type).to_constant (); | |
116 } | |
117 | |
79 #endif | 118 #endif |