aboutsummaryrefslogtreecommitdiff
path: root/gcc/hsa.h
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2016-11-23 15:51:02 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2016-11-23 15:51:02 +0100
commit56b1c60e412fcf1245b4780871553cbdebb956a3 (patch)
tree3a3e101ec1a0e1bdd140db82245f5884d841c62f /gcc/hsa.h
parentf6cdfe826444e1a0b52b271588fbef5c2a4bac4d (diff)
downloadgcc-56b1c60e412fcf1245b4780871553cbdebb956a3.zip
gcc-56b1c60e412fcf1245b4780871553cbdebb956a3.tar.gz
gcc-56b1c60e412fcf1245b4780871553cbdebb956a3.tar.bz2
backport: hsa-builtins.def: New file.
Merge from HSA branch to trunk 2016-11-23 Martin Jambor <mjambor@suse.cz> Martin Liska <mliska@suse.cz> gcc/ * hsa-builtins.def: New file. * Makefile.in (BUILTINS_DEF): Add hsa-builtins.def dependency. * builtins.def: Include hsa-builtins.def. (DEF_HSA_BUILTIN): New macro. * dumpfile.h (OPTGROUP_OPENMP): Define. * dumpfile.c (optgroup_options): Added OPTGROUP_OPENMP. * gimple.h (gf_mask): Added elements GF_OMP_FOR_GRID_INTRA_GROUP and GF_OMP_FOR_GRID_GROUP_ITER. (gimple_omp_for_grid_phony): Added checking assert. (gimple_omp_for_set_grid_phony): Likewise. (gimple_omp_for_grid_intra_group): New function. (gimple_omp_for_set_grid_intra_group): Likewise. (gimple_omp_for_grid_group_iter): Likewise. (gimple_omp_for_set_grid_group_iter): Likewise. * omp-low.c (check_omp_nesting_restrictions): Allow GRID loop where previosuly only distribute loop was permitted. (lower_lastprivate_clauses): Allow non tcc_comparison predicates. (grid_get_kernel_launch_attributes): Support multiple HSA grid dimensions. (grid_expand_omp_for_loop): Likewise and also support standalone distribute constructs. New parameter INTRA_GROUP, updated both users. (grid_expand_target_grid_body): Support standalone distribute constructs. (pass_data_expand_omp): Changed optinfo_flags to OPTGROUP_OPENMP. (pass_data_expand_omp_ssa): Likewise. (pass_data_omp_device_lower): Likewsie. (pass_data_lower_omp): Likewise. (pass_data_diagnose_omp_blocks): Likewise. (pass_data_oacc_device_lower): Likewise. (pass_data_omp_target_link): Likewise. (grid_lastprivate_predicate): New function. (lower_omp_for_lastprivate): Call grid_lastprivate_predicate for gridified loops. (lower_omp_for): Support standalone distribute constructs. (grid_prop): New type. (grid_safe_assignment_p): Check for assignments to group_sizes, new parameter GRID. (grid_seq_only_contains_local_assignments): New parameter GRID, pass it to callee. (grid_find_single_omp_among_assignments_1): Likewise, improve missed optimization info messages. (grid_find_single_omp_among_assignments): Likewise. (grid_find_ungridifiable_statement): Do not bail out for SIMDs. (grid_parallel_clauses_gridifiable): New function. (grid_inner_loop_gridifiable_p): Likewise. (grid_dist_follows_simple_pattern): Likewise. (grid_gfor_follows_tiling_pattern): Likewise. (grid_call_permissible_in_distribute_p): Likewise. (grid_handle_call_in_distribute): Likewise. (grid_dist_follows_tiling_pattern): Likewise. (grid_target_follows_gridifiable_pattern): Support standalone distribute constructs. (grid_var_segment): New enum. (grid_mark_variable_segment): New function. (grid_copy_leading_local_assignments): Call grid_mark_variable_segment if a new argument says so. (grid_process_grid_body): New function. (grid_eliminate_combined_simd_part): Likewise. (grid_mark_tiling_loops): Likewise. (grid_mark_tiling_parallels_and_loops): Likewise. (grid_process_kernel_body_copy): Support standalone distribute constructs. (grid_attempt_target_gridification): New grid variable holding overall gridification state. Support standalone distribute constructs and collapse clauses. * doc/optinfo.texi (Optimization groups): Document OPTGROUP_OPENMP. * hsa.h (hsa_bb): Add method method append_phi. (hsa_insn_br): Renamed to hsa_insn_cbr, renamed all occurences in all files too. (hsa_insn_br): New class, now the ancestor of hsa_incn_cbr. (is_a_helper <hsa_insn_br *>::test): New function. (is_a_helper <hsa_insn_cbr *>::test): Adjust to only cover conditional branch instructions. (hsa_insn_signal): Make a direct descendant of hsa_insn_basic. Add memorder constructor parameter and m_memory_order and m_signalop member variables. (hsa_insn_queue): Changed constructor parameters to common form. Added m_segment and m_memory_order member variables. (hsa_summary_t): Add private member function process_gpu_implementation_attributes. (hsa_function_summary): Rename m_binded_function to m_bound_function. (hsa_insn_basic_p): Remove typedef. (hsa_op_with_type): Change hsa_insn_basic_p into plain pointers. (hsa_op_reg_p): Remove typedef. (hsa_function_representation): Change hsa_op_reg_p into plain pointers. (hsa_insn_phi): Removed new and delete operators. (hsa_insn_br): Likewise. (hsa_insn_cbr): Likewise. (hsa_insn_sbr): Likewise. (hsa_insn_cmp): Likewise. (hsa_insn_mem): Likewise. (hsa_insn_atomic): Likewise. (hsa_insn_signal): Likewise. (hsa_insn_seg): Likewise. (hsa_insn_call): Likewise. (hsa_insn_arg_block): Likewise. (hsa_insn_comment): Likewise. (hsa_insn_srctype): Likewise. (hsa_insn_packed): Likewise. (hsa_insn_cvt): Likewise. (hsa_insn_alloca): Likewise. * hsa.c (hsa_destroy_insn): Also handle instances of hsa_insn_br. (process_gpu_implementation_attributes): New function. (link_functions): Move some functionality into it. Adjust after renaming m_binded_functions to m_bound_functions. (hsa_insn_basic::op_output_p): Add BRIG_OPCODE_DEBUGTRAP to the list of instructions with no output registers. (get_in_type): Return this if it is a register of matching size. (hsa_get_declaration_name): Moved to... * hsa-gen.c (hsa_get_declaration_name): ...here. Allocate temporary string on an obstack instead from ggc. (query_hsa_grid): Renamed to query_hsa_grid_dim, reimplemented, cut down to two overloads. (hsa_allocp_operand_address): Removed. (hsa_allocp_operand_immed): Likewise. (hsa_allocp_operand_reg): Likewise. (hsa_allocp_operand_code_list): Likewise. (hsa_allocp_operand_operand_list): Likewise. (hsa_allocp_inst_basic): Likewise. (hsa_allocp_inst_phi): Likewise. (hsa_allocp_inst_mem): Likewise. (hsa_allocp_inst_atomic): Likewise. (hsa_allocp_inst_signal): Likewise. (hsa_allocp_inst_seg): Likewise. (hsa_allocp_inst_cmp): Likewise. (hsa_allocp_inst_br): Likewise. (hsa_allocp_inst_sbr): Likewise. (hsa_allocp_inst_call): Likewise. (hsa_allocp_inst_arg_block): Likewise. (hsa_allocp_inst_comment): Likewise. (hsa_allocp_inst_queue): Likewise. (hsa_allocp_inst_srctype): Likewise. (hsa_allocp_inst_packed): Likewise. (hsa_allocp_inst_cvt): Likewise. (hsa_allocp_inst_alloca): Likewise. (hsa_allocp_bb): Likewise. (hsa_obstack): New. (hsa_init_data_for_cfun): Initialize obstack. (hsa_deinit_data_for_cfun): Release memory of the obstack. (hsa_op_immed::operator new): Use obstack instead of object_allocator. (hsa_op_reg::operator new): Likewise. (hsa_op_address::operator new): Likewise. (hsa_op_code_list::operator new): Likewise. (hsa_op_operand_list::operator new): Likewise. (hsa_insn_basic::operator new): Likewise. (hsa_insn_phi::operator new): Likewise. (hsa_insn_br::operator new): Likewise. (hsa_insn_sbr::operator new): Likewise. (hsa_insn_cmp::operator new): Likewise. (hsa_insn_mem::operator new): Likewise. (hsa_insn_atomic::operator new): Likewise. (hsa_insn_signal::operator new): Likewise. (hsa_insn_seg::operator new): Likewise. (hsa_insn_call::operator new): Likewise. (hsa_insn_arg_block::operator new): Likewise. (hsa_insn_comment::operator new): Likewise. (hsa_insn_srctype::operator new): Likewise. (hsa_insn_packed::operator new): Likewise. (hsa_insn_cvt::operator new): Likewise. (hsa_insn_alloca::operator new): Likewise. (hsa_init_new_bb): Likewise. (hsa_bb::append_phi): New function. (gen_hsa_phi_from_gimple_phi): Use it. (get_symbol_for_decl): Fix dinstinguishing between global and local functions. Put local variables into a segment according to their attribute or static flag, if there is one. (hsa_insn_br::hsa_insn_br): New. (hsa_insn_br::operator new): Likewise. (hsa_insn_cbr::hsa_insn_cbr): Set width via ancestor constructor. (query_hsa_grid_nodim): New function. (multiply_grid_dim_characteristics): Likewise. (gen_get_num_threads): Likewise. (gen_get_num_teams): Reimplemented. (gen_get_team_num): Likewise. (gen_hsa_insns_for_known_library_call): Updated calls to the above helper functions. (get_memory_order_name): Removed. (get_memory_order): Likewise. (hsa_memorder_from_tree): New function. (gen_hsa_ternary_atomic_for_builtin): Renamed to gen_hsa_atomic_for_builtin, can also create signals. (gen_hsa_insns_for_call): Handle many new builtins. Adjust to use hsa_memory_order_from_tree and gen_hsa_atomic_for_builtin. (hsa_insn_atomic): Fix function comment. (hsa_insn_signal::hsa_insn_signal): Fix comment. Update call to ancestor constructor and initialization of new member variables. (hsa_insn_queue::hsa_insn_queue): Added initialization of new member variables. (hsa_get_host_function): Handle functions with no bound CPU implementation. Fix binded to bound. (get_brig_function_name): Likewise. (HSA_SORRY_ATV): Remove semicolon after macro. (HSA_SORRY_AT): Likewise. (omp_simple_builtin::generate): Add missing semicolons. (hsa_insn_phi::operator new): Removed. (hsa_insn_br::operator new): Likewise. (hsa_insn_cbr::operator new): Likewise. (hsa_insn_sbr::operator new): Likewise. (hsa_insn_cmp::operator new): Likewise. (hsa_insn_mem::operator new): Likewise. (hsa_insn_atomic::operator new): Likewise. (hsa_insn_signal::operator new): Likewise. (hsa_insn_seg::operator new): Likewise. (hsa_insn_call::operator new): Likewise. (hsa_insn_arg_block::operator new): Likewise. (hsa_insn_comment::operator new): Likewise. (hsa_insn_srctype::operator new): Likewise. (hsa_insn_packed::operator new): Likewise. (hsa_insn_cvt::operator new): Likewise. (hsa_insn_alloca::operator new): Likewise. (get_symbol_for_decl): Accept CONST_DECLs, put them to readonly segment. (gen_hsa_addr): Also process CONST_DECLs. (gen_hsa_addr_insns): Process CONST_DECLs by creating private copies. (gen_hsa_unary_operation): Make sure the function does not use bittype source type for firstbit and lastbit operations. (gen_hsa_popcount_to_dest): Make sure the function uses a bittype source type. * hsa-brig.c (emit_insn_operands): Cope with zero operands in an instruction. (emit_branch_insn): Renamed to emit_cond_branch_insn. Emit the width stored in the class. (emit_generic_branch_insn): New function. (emit_insn): Call emit_generic_branch_insn. (emit_signal_insn): Remove obsolete comment. Update member variable name, pick a type according to profile. (emit_alloca_insn): Remove obsolete comment. (emit_atomic_insn): Likewise. (emit_queue_insn): Get segment and memory order from the IR object. (hsa_brig_section): Make allocate_new_chunk, chunks and cur_chunk provate, add a default NULL parameter to add method. (hsa_brig_section::add): Added a new parameter, store pointer to output data there if it is non-NULL. (emit_function_directives): Use this new parameter instead of calculating the pointer itself, fix function comment. (hsa_brig_emit_function): Add forgotten endian conversion. (hsa_output_kernels): Remove unnecessary building of kernel_dependencies_vector_type. (emit_immediate_operand): Declare. (emit_directive_variable): Also emit initializers of CONST_DECLs. (gen_hsa_insn_for_internal_fn_call): Also handle IFN_RSQRT. (verify_function_arguments): Properly detect variadic arguments. * hsa-dump.c (hsa_width_specifier_name): New function. (dump_hsa_insn_1): Dump generic branch instructions, update signal member variable name. Special dumping for queue objects. * ipa-hsa.c (process_hsa_functions): Adjust after renaming m_binded_functions to m_bound_functions. Copy externally visible flag to the node. (ipa_hsa_write_summary): Likewise. (ipa_hsa_read_section): Likewise. gcc/fortran/ * f95-lang.c (DEF_HSA_BUILTIN): New macro. gcc/testsuite/ * c-c++-common/gomp/gridify-1.c: Update scan string. * gfortran.dg/gomp/gridify-1.f90: Likewise. * c-c++-common/gomp/gridify-2.c: New test. * c-c++-common/gomp/gridify-3.c: Likewise. libgomp/ * testsuite/libgomp.hsa.c/bits-insns.c: New test. * testsuite/libgomp.hsa.c/tiling-1.c: Likewise. * testsuite/libgomp.hsa.c/tiling-2.c: Likewise. Co-Authored-By: Martin Liska <mliska@suse.cz> From-SVN: r242761
Diffstat (limited to 'gcc/hsa.h')
-rw-r--r--gcc/hsa.h157
1 files changed, 70 insertions, 87 deletions
diff --git a/gcc/hsa.h b/gcc/hsa.h
index 1b57a3c..c00ffd5 100644
--- a/gcc/hsa.h
+++ b/gcc/hsa.h
@@ -50,7 +50,6 @@ class hsa_insn_basic;
class hsa_op_address;
class hsa_op_reg;
class hsa_bb;
-typedef hsa_insn_basic *hsa_insn_basic_p;
/* Class representing an input argument, output argument (result) or a
variable, that will eventually end up being a symbol directive. */
@@ -72,7 +71,8 @@ struct hsa_symbol
void fillup_for_decl (tree decl);
/* Pointer to the original tree, which is PARM_DECL for input parameters and
- RESULT_DECL for the output parameters. */
+ RESULT_DECL for the output parameters. Also can be CONST_DECL for Fortran
+ constants which need to be put into readonly segment. */
tree m_decl;
/* Name of the symbol, that will be written into output and dumps. Can be
@@ -259,11 +259,9 @@ private:
/* Set definition where the register is defined. */
void set_definition (hsa_insn_basic *insn);
/* Uses of the value while still in SSA. */
- auto_vec <hsa_insn_basic_p> m_uses;
+ auto_vec <hsa_insn_basic *> m_uses;
};
-typedef class hsa_op_reg *hsa_op_reg_p;
-
/* Report whether or not P is a register operand. */
template <>
@@ -490,17 +488,12 @@ class hsa_insn_phi : public hsa_insn_basic
public:
hsa_insn_phi (unsigned nops, hsa_op_reg *dst);
- void *operator new (size_t);
-
/* Destination. */
hsa_op_reg *m_dest;
private:
/* Make the default constructor inaccessible. */
hsa_insn_phi () : hsa_insn_basic (1, HSA_OPCODE_PHI) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether or not P is a PHI node. */
@@ -513,35 +506,56 @@ is_a_helper <hsa_insn_phi *>::test (hsa_insn_basic *p)
return p->m_opcode == HSA_OPCODE_PHI;
}
-/* HSA instruction for branches. Currently we explicitely represent only
- conditional branches. */
-
+/* HSA instruction for */
class hsa_insn_br : public hsa_insn_basic
{
public:
- hsa_insn_br (hsa_op_reg *ctrl);
-
- void *operator new (size_t);
+ hsa_insn_br (unsigned nops, int opc, BrigType16_t t, BrigWidth8_t width,
+ hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL,
+ hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL);
- /* Width as described in HSA documentation. */
+ /* Number of work-items affected in the same way by the instruction. */
BrigWidth8_t m_width;
+
private:
/* Make the default constructor inaccessible. */
- hsa_insn_br () : hsa_insn_basic (1, BRIG_OPCODE_CBR) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
+ hsa_insn_br () : hsa_insn_basic (0, BRIG_OPCODE_BR) {}
};
-/* Report whether P is a branching instruction. */
+/* Return true if P is a branching/synchronization instruction. */
template <>
template <>
inline bool
is_a_helper <hsa_insn_br *>::test (hsa_insn_basic *p)
{
- return p->m_opcode == BRIG_OPCODE_BR
- || p->m_opcode == BRIG_OPCODE_CBR;
+ return p->m_opcode == BRIG_OPCODE_BARRIER
+ || p->m_opcode == BRIG_OPCODE_BR;
+}
+
+/* HSA instruction for conditional branches. Structurally the same as
+ hsa_insn_br but we represent it specially because of inherent control
+ flow it represents. */
+
+class hsa_insn_cbr : public hsa_insn_br
+{
+public:
+ hsa_insn_cbr (hsa_op_reg *ctrl);
+
+private:
+ /* Make the default constructor inaccessible. */
+ hsa_insn_cbr () : hsa_insn_br (0, BRIG_OPCODE_CBR, BRIG_TYPE_B1,
+ BRIG_WIDTH_1) {}
+};
+
+/* Report whether P is a contitional branching instruction. */
+
+template <>
+template <>
+inline bool
+is_a_helper <hsa_insn_cbr *>::test (hsa_insn_basic *p)
+{
+ return p->m_opcode == BRIG_OPCODE_CBR;
}
/* HSA instruction for switch branches. */
@@ -554,8 +568,6 @@ public:
/* Default destructor. */
~hsa_insn_sbr ();
- void *operator new (size_t);
-
void replace_all_labels (basic_block old_bb, basic_block new_bb);
/* Width as described in HSA documentation. */
@@ -570,9 +582,6 @@ public:
private:
/* Make the default constructor inaccessible. */
hsa_insn_sbr () : hsa_insn_basic (1, BRIG_OPCODE_SBR) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether P is a switch branching instruction. */
@@ -594,8 +603,6 @@ public:
hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL,
hsa_op_base *arg2 = NULL);
- void *operator new (size_t);
-
/* Source type should be derived from operand types. */
/* The comparison operation. */
@@ -606,9 +613,6 @@ public:
private:
/* Make the default constructor inaccessible. */
hsa_insn_cmp () : hsa_insn_basic (1, BRIG_OPCODE_CMP) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether or not P is a comparison instruction. */
@@ -628,8 +632,6 @@ class hsa_insn_mem : public hsa_insn_basic
public:
hsa_insn_mem (int opc, BrigType16_t t, hsa_op_base *arg0, hsa_op_base *arg1);
- void *operator new (size_t);
-
/* Set alignment to VALUE. */
void set_align (BrigAlignment8_t value);
@@ -652,9 +654,6 @@ protected:
private:
/* Make the default constructor inaccessible. */
hsa_insn_mem () : hsa_insn_basic (1, BRIG_OPCODE_LD) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether or not P is a memory instruction. */
@@ -677,7 +676,6 @@ public:
BrigType16_t t, BrigMemoryOrder memorder,
hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL,
hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL);
- void *operator new (size_t);
/* The operation itself. */
enum BrigAtomicOperation m_atomicop;
@@ -691,9 +689,6 @@ public:
private:
/* Make the default constructor inaccessible. */
hsa_insn_atomic () : hsa_insn_mem (1, BRIG_KIND_NONE, BRIG_TYPE_NONE) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether or not P is an atomic instruction. */
@@ -709,20 +704,19 @@ is_a_helper <hsa_insn_atomic *>::test (hsa_insn_basic *p)
/* HSA instruction for signal operations. */
-class hsa_insn_signal : public hsa_insn_atomic
+class hsa_insn_signal : public hsa_insn_basic
{
public:
hsa_insn_signal (int nops, int opc, enum BrigAtomicOperation sop,
- BrigType16_t t, hsa_op_base *arg0 = NULL,
- hsa_op_base *arg1 = NULL,
+ BrigType16_t t, BrigMemoryOrder memorder,
+ hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL,
hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL);
- void *operator new (size_t);
+ /* Things like acquire/release/aligned. */
+ enum BrigMemoryOrder m_memory_order;
-private:
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
+ /* The operation itself. */
+ enum BrigAtomicOperation m_signalop;
};
/* Report whether or not P is a signal instruction. */
@@ -744,8 +738,6 @@ public:
hsa_insn_seg (int opc, BrigType16_t destt, BrigType16_t srct,
BrigSegment8_t seg, hsa_op_base *arg0, hsa_op_base *arg1);
- void *operator new (size_t);
-
/* Source type. Depends on the source addressing/segment. */
BrigType16_t m_src_type;
/* The segment we are converting from or to. */
@@ -753,9 +745,6 @@ public:
private:
/* Make the default constructor inaccessible. */
hsa_insn_seg () : hsa_insn_basic (1, BRIG_OPCODE_STOF) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether or not P is a segment conversion instruction. */
@@ -812,8 +801,6 @@ public:
/* Default destructor. */
~hsa_insn_call ();
- void *operator new (size_t);
-
/* Called function. */
tree m_called_function;
@@ -840,9 +827,6 @@ public:
private:
/* Make the default constructor inaccessible. */
hsa_insn_call () : hsa_insn_basic (0, BRIG_OPCODE_CALL) {}
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether or not P is a call instruction. */
@@ -866,17 +850,11 @@ class hsa_insn_arg_block : public hsa_insn_basic
public:
hsa_insn_arg_block (BrigKind brig_kind, hsa_insn_call * call);
- void *operator new (size_t);
-
/* Kind of argument block. */
BrigKind m_kind;
/* Call instruction. */
hsa_insn_call *m_call_insn;
-private:
- /* All objects are deallocated by destroying their pool, so make delete
- inaccessible too. */
- void operator delete (void *) {}
};
/* Report whether or not P is a call block instruction. */
@@ -900,8 +878,6 @@ public:
/* Default destructor. */
~hsa_insn_comment ();
- void *operator new (size_t);
-
char *m_comment;
};
@@ -920,10 +896,18 @@ is_a_helper <hsa_insn_comment *>::test (hsa_insn_basic *p)
class hsa_insn_queue: public hsa_insn_basic
{
public:
- hsa_insn_queue (int nops, BrigOpcode opcode);
+ hsa_insn_queue (int nops, int opcode, BrigSegment segment,
+ BrigMemoryOrder memory_order,
+ hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL,
+ hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL);
/* Destructor. */
~hsa_insn_queue ();
+
+ /* Segment used to refer to the queue. Must be global or flat. */
+ BrigSegment m_segment;
+ /* Memory order used to specify synchronization. */
+ BrigMemoryOrder m_memory_order;
};
/* Report whether or not P is a queue instruction. */
@@ -933,7 +917,12 @@ template <>
inline bool
is_a_helper <hsa_insn_queue *>::test (hsa_insn_basic *p)
{
- return (p->m_opcode == BRIG_OPCODE_ADDQUEUEWRITEINDEX);
+ return (p->m_opcode == BRIG_OPCODE_ADDQUEUEWRITEINDEX
+ || p->m_opcode == BRIG_OPCODE_CASQUEUEWRITEINDEX
+ || p->m_opcode == BRIG_OPCODE_LDQUEUEREADINDEX
+ || p->m_opcode == BRIG_OPCODE_LDQUEUEWRITEINDEX
+ || p->m_opcode == BRIG_OPCODE_STQUEUEREADINDEX
+ || p->m_opcode == BRIG_OPCODE_STQUEUEWRITEINDEX);
}
/* HSA source type instruction. */
@@ -945,9 +934,6 @@ public:
BrigType16_t srct, hsa_op_base *arg0, hsa_op_base *arg1,
hsa_op_base *arg2);
- /* Pool allocator. */
- void *operator new (size_t);
-
/* Source type. */
BrigType16_t m_source_type;
@@ -976,9 +962,6 @@ public:
BrigType16_t srct, hsa_op_base *arg0, hsa_op_base *arg1,
hsa_op_base *arg2);
- /* Pool allocator. */
- void *operator new (size_t);
-
/* Operand list for an operand of the instruction. */
hsa_op_operand_list *m_operand_list;
@@ -1003,9 +986,6 @@ class hsa_insn_cvt: public hsa_insn_basic
{
public:
hsa_insn_cvt (hsa_op_with_type *dest, hsa_op_with_type *src);
-
- /* Pool allocator. */
- void *operator new (size_t);
};
/* Report whether or not P is a convert instruction. */
@@ -1028,9 +1008,6 @@ public:
/* Required alignment of the allocation. */
BrigAlignment8_t m_align;
-
- /* Pool allocator. */
- void *operator new (size_t);
};
/* Report whether or not P is an alloca instruction. */
@@ -1055,6 +1032,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;
@@ -1217,7 +1197,7 @@ public:
unsigned m_temp_symbol_count;
/* SSA names mapping. */
- vec <hsa_op_reg_p> m_ssa_map;
+ vec <hsa_op_reg *> m_ssa_map;
/* Flag whether a function needs update of dominators before RA. */
bool m_modified_cfg;
@@ -1239,9 +1219,9 @@ struct hsa_function_summary
hsa_function_kind m_kind;
/* Pointer to a cgraph node which is a HSA implementation of the function.
- In case of the function is a HSA function, the binded function points
+ In case of the function is a HSA function, the bound function points
to the host function. */
- cgraph_node *m_binded_function;
+ cgraph_node *m_bound_function;
/* Identifies if the function is an HSA function or a host function. */
bool m_gpu_implementation_p;
@@ -1252,7 +1232,7 @@ struct hsa_function_summary
inline
hsa_function_summary::hsa_function_summary (): m_kind (HSA_NONE),
- m_binded_function (NULL), m_gpu_implementation_p (false)
+ m_bound_function (NULL), m_gpu_implementation_p (false)
{
}
@@ -1270,6 +1250,9 @@ public:
void link_functions (cgraph_node *gpu, cgraph_node *host,
hsa_function_kind kind, bool gridified_kernel_p);
+
+private:
+ void process_gpu_implementation_attributes (tree gdecl);
};
/* OMP simple builtin describes behavior that should be done for