40 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9//10//===----------------------------------------------------------------------===//11 12#ifndef OMPTARGET_ALLOCATOR_H13#define OMPTARGET_ALLOCATOR_H14 15#include "DeviceTypes.h"16 17namespace ompx {18 19namespace allocator {20 21static uint64_t constexpr ALIGNMENT = 16;22 23/// Allocate \p Size bytes.24[[gnu::alloc_size(1), gnu::assume_aligned(ALIGNMENT), gnu::malloc]] void *25alloc(uint64_t Size);26 27/// Free the allocation pointed to by \p Ptr.28void free(void *Ptr);29 30} // namespace allocator31 32} // namespace ompx33 34extern "C" {35void *malloc(size_t Size);36void free(void *Ptr);37}38 39#endif40