Skip to content

Commit fd2d0bf

Browse files
authored
[OpenMP][NFC] Replace unnecessary typedefs (#73815)
1 parent e2299e8 commit fd2d0bf

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

openmp/libomptarget/include/OpenMP/InternalTypes.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
#include <cstddef>
1717
#include <cstdint>
1818

19-
typedef intptr_t kmp_intptr_t;
20-
2119
extern "C" {
2220

2321
// Compiler sends us this info:
2422
typedef struct kmp_depend_info {
25-
kmp_intptr_t base_addr;
23+
intptr_t base_addr;
2624
size_t len;
2725
struct {
2826
bool in : 1;

openmp/libomptarget/src/api.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ EXTERN int omp_target_memcpy(void *Dst, const void *Src, size_t Length,
212212
}
213213

214214
// The helper function that calls omp_target_memcpy or omp_target_memcpy_rect
215-
static int libomp_target_memcpy_async_task(kmp_int32 Gtid, kmp_task_t *Task) {
215+
static int libomp_target_memcpy_async_task(int32_t Gtid, kmp_task_t *Task) {
216216
if (Task == nullptr)
217217
return OFFLOAD_FAIL;
218218

@@ -243,7 +243,7 @@ static int libomp_target_memcpy_async_task(kmp_int32 Gtid, kmp_task_t *Task) {
243243
return Rc;
244244
}
245245

246-
static int libomp_target_memset_async_task(kmp_int32 Gtid, kmp_task_t *Task) {
246+
static int libomp_target_memset_async_task(int32_t Gtid, kmp_task_t *Task) {
247247
if (!Task)
248248
return OFFLOAD_FAIL;
249249

@@ -270,13 +270,13 @@ convertDepObjVector(llvm::SmallVector<kmp_depend_info_t> &Vec, int DepObjCount,
270270

271271
template <class T>
272272
static inline int
273-
libomp_helper_task_creation(T *Args, int (*Fn)(kmp_int32, kmp_task_t *),
273+
libomp_helper_task_creation(T *Args, int (*Fn)(int32_t, kmp_task_t *),
274274
int DepObjCount, omp_depend_t *DepObjList) {
275275
// Create global thread ID
276276
int Gtid = __kmpc_global_thread_num(nullptr);
277277

278278
// Setup the hidden helper flags
279-
kmp_int32 Flags = 0;
279+
int32_t Flags = 0;
280280
kmp_tasking_flags_t *InputFlags = (kmp_tasking_flags_t *)&Flags;
281281
InputFlags->hidden_helper = 1;
282282

openmp/libomptarget/src/private.h

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,13 @@ extern "C" {
110110
* The struct is identical to the one in the kmp.h file.
111111
* We maintain the same data structure for compatibility.
112112
*/
113-
typedef int kmp_int32;
114-
typedef int64_t kmp_int64;
115-
116113
typedef void *omp_depend_t;
117114
struct kmp_task;
118-
typedef kmp_int32 (*kmp_routine_entry_t)(kmp_int32, struct kmp_task *);
115+
typedef int32_t (*kmp_routine_entry_t)(int32_t, struct kmp_task *);
119116
typedef struct kmp_task {
120117
void *shareds;
121118
kmp_routine_entry_t routine;
122-
kmp_int32 part_id;
119+
int32_t part_id;
123120
} kmp_task_t;
124121

125122
typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */
@@ -157,26 +154,26 @@ typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */
157154

158155
int32_t __kmpc_global_thread_num(void *) __attribute__((weak));
159156
int __kmpc_get_target_offload(void) __attribute__((weak));
160-
void **__kmpc_omp_get_target_async_handle_ptr(kmp_int32 gtid)
157+
void **__kmpc_omp_get_target_async_handle_ptr(int32_t gtid)
161158
__attribute__((weak));
162-
bool __kmpc_omp_has_task_team(kmp_int32 gtid) __attribute__((weak));
163-
kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
164-
kmp_int32 flags, size_t sizeof_kmp_task_t,
159+
bool __kmpc_omp_has_task_team(int32_t gtid) __attribute__((weak));
160+
kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags,
161+
size_t sizeof_kmp_task_t,
165162
size_t sizeof_shareds,
166163
kmp_routine_entry_t task_entry)
167164
__attribute__((weak));
168165

169166
kmp_task_t *
170-
__kmpc_omp_target_task_alloc(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 flags,
167+
__kmpc_omp_target_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags,
171168
size_t sizeof_kmp_task_t, size_t sizeof_shareds,
172-
kmp_routine_entry_t task_entry,
173-
kmp_int64 device_id) __attribute__((weak));
174-
175-
kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
176-
kmp_task_t *new_task, kmp_int32 ndeps,
177-
kmp_depend_info_t *dep_list,
178-
kmp_int32 ndeps_noalias,
179-
kmp_depend_info_t *noalias_dep_list)
169+
kmp_routine_entry_t task_entry, int64_t device_id)
170+
__attribute__((weak));
171+
172+
int32_t __kmpc_omp_task_with_deps(ident_t *loc_ref, int32_t gtid,
173+
kmp_task_t *new_task, int32_t ndeps,
174+
kmp_depend_info_t *dep_list,
175+
int32_t ndeps_noalias,
176+
kmp_depend_info_t *noalias_dep_list)
180177
__attribute__((weak));
181178

182179
/**

0 commit comments

Comments
 (0)