omp-general.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* General types and functions that are uselful for processing of OpenMP,
  2. OpenACC and similar directivers at various stages of compilation.
  3. Copyright (C) 2005-2019 Free Software Foundation, Inc.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_OMP_GENERAL_H
  17. #define GCC_OMP_GENERAL_H
  18. #include "gomp-constants.h"
  19. /* Flags for an OpenACC loop. */
  20. enum oacc_loop_flags {
  21. OLF_SEQ = 1u << 0, /* Explicitly sequential */
  22. OLF_AUTO = 1u << 1, /* Compiler chooses axes. */
  23. OLF_INDEPENDENT = 1u << 2, /* Iterations are known independent. */
  24. OLF_GANG_STATIC = 1u << 3, /* Gang partitioning is static (has op). */
  25. OLF_TILE = 1u << 4, /* Tiled loop. */
  26. /* Explicitly specified loop axes. */
  27. OLF_DIM_BASE = 5,
  28. OLF_DIM_GANG = 1u << (OLF_DIM_BASE + GOMP_DIM_GANG),
  29. OLF_DIM_WORKER = 1u << (OLF_DIM_BASE + GOMP_DIM_WORKER),
  30. OLF_DIM_VECTOR = 1u << (OLF_DIM_BASE + GOMP_DIM_VECTOR),
  31. OLF_MAX = OLF_DIM_BASE + GOMP_DIM_MAX
  32. };
  33. /* A structure holding the elements of:
  34. for (V = N1; V cond N2; V += STEP) [...] */
  35. struct omp_for_data_loop
  36. {
  37. tree v, n1, n2, step;
  38. enum tree_code cond_code;
  39. };
  40. /* A structure describing the main elements of a parallel loop. */
  41. struct omp_for_data
  42. {
  43. struct omp_for_data_loop loop;
  44. tree chunk_size;
  45. gomp_for *for_stmt;
  46. tree pre, iter_type;
  47. tree tiling; /* Tiling values (if non null). */
  48. int collapse; /* Collapsed loops, 1 for a non-collapsed loop. */
  49. int ordered;
  50. bool have_nowait, have_ordered, simd_schedule, have_reductemp;
  51. unsigned char sched_modifiers;
  52. enum omp_clause_schedule_kind sched_kind;
  53. struct omp_for_data_loop *loops;
  54. };
  55. #define OACC_FN_ATTRIB "oacc function"
  56. extern tree omp_find_clause (tree clauses, enum omp_clause_code kind);
  57. extern bool omp_is_reference (tree decl);
  58. extern void omp_adjust_for_condition (location_t loc, enum tree_code *cond_code,
  59. tree *n2, tree v, tree step);
  60. extern tree omp_get_for_step_from_incr (location_t loc, tree incr);
  61. extern void omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd,
  62. struct omp_for_data_loop *loops);
  63. extern gimple *omp_build_barrier (tree lhs);
  64. extern poly_uint64 omp_max_vf (void);
  65. extern int omp_max_simt_vf (void);
  66. extern tree oacc_launch_pack (unsigned code, tree device, unsigned op);
  67. extern tree oacc_replace_fn_attrib_attr (tree attribs, tree dims);
  68. extern void oacc_replace_fn_attrib (tree fn, tree dims);
  69. extern void oacc_set_fn_attrib (tree fn, tree clauses, vec<tree> *args);
  70. extern tree oacc_build_routine_dims (tree clauses);
  71. extern tree oacc_get_fn_attrib (tree fn);
  72. extern bool offloading_function_p (tree fn);
  73. extern int oacc_get_fn_dim_size (tree fn, int axis);
  74. extern int oacc_get_ifn_dim_arg (const gimple *stmt);
  75. enum omp_requires {
  76. OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER = 0xf,
  77. OMP_REQUIRES_UNIFIED_ADDRESS = 0x10,
  78. OMP_REQUIRES_UNIFIED_SHARED_MEMORY = 0x20,
  79. OMP_REQUIRES_DYNAMIC_ALLOCATORS = 0x40,
  80. OMP_REQUIRES_REVERSE_OFFLOAD = 0x80,
  81. OMP_REQUIRES_ATOMIC_DEFAULT_MEM_ORDER_USED = 0x100,
  82. OMP_REQUIRES_TARGET_USED = 0x200
  83. };
  84. extern GTY(()) enum omp_requires omp_requires_mask;
  85. #endif /* GCC_OMP_GENERAL_H */