clang 22.0.0git
ByteCodeEmitter.cpp File Reference
#include "ByteCodeEmitter.h"
#include "Context.h"
#include "Floating.h"
#include "IntegralAP.h"
#include "Opcode.h"
#include "Program.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
#include <type_traits>
#include "Opcodes.inc"

Go to the source code of this file.

Macros

#define GET_LINK_IMPL

Functions

template<typename T>
static void emit (Program &P, llvm::SmallVectorImpl< std::byte > &Code, const T &Val, bool &Success)
 Helper to write bytecode and bail out if 32-bit offsets become invalid.
template<typename T>
static void emitSerialized (llvm::SmallVectorImpl< std::byte > &Code, const T &Val, bool &Success)
 Emits a serializable value.
template<>
void emit (Program &P, llvm::SmallVectorImpl< std::byte > &Code, const Floating &Val, bool &Success)
template<>
void emit (Program &P, llvm::SmallVectorImpl< std::byte > &Code, const IntegralAP< false > &Val, bool &Success)
template<>
void emit (Program &P, llvm::SmallVectorImpl< std::byte > &Code, const IntegralAP< true > &Val, bool &Success)
template<>
void emit (Program &P, llvm::SmallVectorImpl< std::byte > &Code, const FixedPoint &Val, bool &Success)

Macro Definition Documentation

◆ GET_LINK_IMPL

#define GET_LINK_IMPL

Definition at line 257 of file ByteCodeEmitter.cpp.

Function Documentation

◆ emit() [1/5]

template<>
void emit ( Program & P,
llvm::SmallVectorImpl< std::byte > & Code,
const FixedPoint & Val,
bool & Success )

Definition at line 204 of file ByteCodeEmitter.cpp.

References emitSerialized(), and clang::Success.

◆ emit() [2/5]

template<>
void emit ( Program & P,
llvm::SmallVectorImpl< std::byte > & Code,
const Floating & Val,
bool & Success )

Definition at line 186 of file ByteCodeEmitter.cpp.

References emitSerialized(), and clang::Success.

◆ emit() [3/5]

template<>
void emit ( Program & P,
llvm::SmallVectorImpl< std::byte > & Code,
const IntegralAP< false > & Val,
bool & Success )

Definition at line 192 of file ByteCodeEmitter.cpp.

References emitSerialized(), and clang::Success.

◆ emit() [4/5]

template<>
void emit ( Program & P,
llvm::SmallVectorImpl< std::byte > & Code,
const IntegralAP< true > & Val,
bool & Success )

Definition at line 198 of file ByteCodeEmitter.cpp.

References emitSerialized(), and clang::Success.

◆ emit() [5/5]

template<typename T>
void emit ( Program & P,
llvm::SmallVectorImpl< std::byte > & Code,
const T & Val,
bool & Success )
static

Helper to write bytecode and bail out if 32-bit offsets become invalid.

Pointers will be automatically marshalled as 32-bit IDs.

Definition at line 136 of file ByteCodeEmitter.cpp.

References clang::interp::align(), clang::interp::aligned(), clang::interp::Program::getOrCreateNativePointer(), clang::Success, and clang::T.

Referenced by clang::interp::Compiler< Emitter >::VisitCXXThisExpr().

◆ emitSerialized()

template<typename T>
void emitSerialized ( llvm::SmallVectorImpl< std::byte > & Code,
const T & Val,
bool & Success )
static

Emits a serializable value.

These usually (potentially) contain heap-allocated memory and aren't trivially copyable.

Definition at line 167 of file ByteCodeEmitter.cpp.

References clang::interp::align(), clang::interp::aligned(), clang::Success, and clang::T.

Referenced by emit(), emit(), emit(), and emit().