llvm/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp

//===- MCJITTest.cpp - Unit tests for the MCJIT -----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This test suite verifies basic MCJIT functionality when invoked from the C
// API.
//
//===----------------------------------------------------------------------===//

#include "MCJITTestAPICommon.h"
#include "llvm-c/Analysis.h"
#include "llvm-c/Core.h"
#include "llvm-c/ExecutionEngine.h"
#include "llvm-c/Target.h"
#include "llvm-c/Transforms/PassBuilder.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/Support/Debug.h"
#include "llvm/TargetParser/Host.h"
#include "gtest/gtest.h"

usingnamespacellvm;

static bool didCallAllocateCodeSection;
static bool didAllocateCompactUnwindSection;
static bool didCallYield;

static uint8_t *roundTripAllocateCodeSection(void *object, uintptr_t size,
                                             unsigned alignment,
                                             unsigned sectionID,
                                             const char *sectionName) {}

static uint8_t *roundTripAllocateDataSection(void *object, uintptr_t size,
                                             unsigned alignment,
                                             unsigned sectionID,
                                             const char *sectionName,
                                             LLVMBool isReadOnly) {}

static LLVMBool roundTripFinalizeMemory(void *object, char **errMsg) {}

static void roundTripDestroy(void *object) {}

static void yield(LLVMContextRef, void *) {}

namespace {

// memory manager to test reserve allocation space callback
class TestReserveAllocationSpaceMemoryManager: public SectionMemoryManager {};

class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon {};
} // end anonymous namespace

TEST_F(MCJITCAPITest, simple_function) {}

TEST_F(MCJITCAPITest, gva) {}

TEST_F(MCJITCAPITest, gfa) {}

TEST_F(MCJITCAPITest, custom_memory_manager) {}

TEST_F(MCJITCAPITest, stackmap_creates_compact_unwind_on_darwin) {}

#if defined(__APPLE__) && defined(__aarch64__)
// FIXME: Figure out why this fails on mac/arm, PR46647
#define MAYBE_reserve_allocation_space
#else
#define MAYBE_reserve_allocation_space
#endif
TEST_F(MCJITCAPITest, MAYBE_reserve_allocation_space) {}

TEST_F(MCJITCAPITest, yield) {}

static int localTestFunc() {}

TEST_F(MCJITCAPITest, addGlobalMapping) {}