ldc/runtime/jit-rt/cpp-so/context.h
2017-11-05 22:47:10 +03:00

43 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//===-- context.h - jit support ---------------------------------*- C++ -*-===//
//
// LDC the LLVM D compiler
//
// This file is distributed under the Boost Software License. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
//
// Jit compilation context, must be in sync with runtimecompile.d.
//
//===----------------------------------------------------------------------===//
#ifndef CONTEXT_H
#define CONTEXT_H
#include <cstddef> //size_t
enum class DumpStage : int {
OriginalModule = 0,
MergedModule = 1,
OptimizedModule = 2,
FinalAsm = 3
};
typedef void (*InterruptPointHandlerT)(void *, const char *action,
const char *object);
typedef void (*FatalHandlerT)(void *, const char *reason);
typedef void (*DumpHandlerT)(void *, DumpStage stage, const char *str,
std::size_t len);
struct Context final {
unsigned optLevel = 0;
unsigned sizeLevel = 0;
InterruptPointHandlerT interruptPointHandler = nullptr;
void *interruptPointHandlerData = nullptr;
FatalHandlerT fatalHandler = nullptr;
void *fatalHandlerData = nullptr;
DumpHandlerT dumpHandler = nullptr;
void *dumpHandlerData = nullptr;
};
#endif // CONTEXT_H