| 1 |
//===-------- Allocator.h - OpenMP memory allocator interface ---- C++ -*-===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
// |
| 9 |
// |
| 10 |
//===----------------------------------------------------------------------===// |
| 11 |
|
| 12 |
#ifndef OMPTARGET_ALLOCATOR_H |
| 13 |
#define OMPTARGET_ALLOCATOR_H |
| 14 |
|
| 15 |
#include "DeviceTypes.h" |
| 16 |
|
| 17 |
namespace ompx { |
| 18 |
|
| 19 |
namespace allocator { |
| 20 |
|
| 21 |
static uint64_t constexpr ALIGNMENT = 16; |
| 22 |
|
| 23 |
/// Allocate \p Size bytes. |
| 24 |
[[gnu::alloc_size(1), gnu::assume_aligned(ALIGNMENT), gnu::malloc]] void * |
| 25 |
alloc(uint64_t Size); |
| 26 |
|
| 27 |
/// Free the allocation pointed to by \p Ptr. |
| 28 |
void free(void *Ptr); |
| 29 |
|
| 30 |
} // namespace allocator |
| 31 |
|
| 32 |
} // namespace ompx |
| 33 |
|
| 34 |
extern "C" { |
| 35 |
void *malloc(size_t Size); |
| 36 |
void free(void *Ptr); |
| 37 |
} |
| 38 |
|
| 39 |
#endif |