clang 20.0.0git
Macros | Functions
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 "clang/Basic/Builtins.h"
#include <type_traits>
#include "Opcodes.inc"

Go to the source code of this file.

Macros

#define GET_LINK_IMPL
 

Functions

static bool isUnevaluatedBuiltin (unsigned BuiltinID)
 Unevaluated builtins don't get their arguments put on the stack automatically.
 
template<typename T >
static void emit (Program &P, std::vector< 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 (std::vector< std::byte > &Code, const T &Val, bool &Success)
 Emits a serializable value.
 
template<>
void emit (Program &P, std::vector< std::byte > &Code, const Floating &Val, bool &Success)
 
template<>
void emit (Program &P, std::vector< std::byte > &Code, const IntegralAP< false > &Val, bool &Success)
 
template<>
void emit (Program &P, std::vector< std::byte > &Code, const IntegralAP< true > &Val, bool &Success)
 

Macro Definition Documentation

◆ GET_LINK_IMPL

#define GET_LINK_IMPL

Definition at line 386 of file ByteCodeEmitter.cpp.

Function Documentation

◆ emit() [1/4]

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

Definition at line 333 of file ByteCodeEmitter.cpp.

References emitSerialized(), and clang::Success.

◆ emit() [2/4]

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

Definition at line 339 of file ByteCodeEmitter.cpp.

References emitSerialized(), and clang::Success.

◆ emit() [3/4]

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

Definition at line 345 of file ByteCodeEmitter.cpp.

References emitSerialized(), and clang::Success.

◆ emit() [4/4]

template<typename T >
static void emit ( Program P,
std::vector< 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 283 of file ByteCodeEmitter.cpp.

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

Referenced by clang::Sema::BoundTypeDiagnoser< Ts >::diagnose(), and clang::Sema::SizelessTypeDiagnoser< Ts >::diagnose().

◆ emitSerialized()

template<typename T >
static void emitSerialized ( std::vector< 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 314 of file ByteCodeEmitter.cpp.

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

Referenced by emit().

◆ isUnevaluatedBuiltin()

static bool isUnevaluatedBuiltin ( unsigned  BuiltinID)
static

Unevaluated builtins don't get their arguments put on the stack automatically.

They instead operate on the AST of their Call Expression. Similar information is available via ASTContext::BuiltinInfo, but that is not correct for our use cases.

Definition at line 29 of file ByteCodeEmitter.cpp.

Referenced by clang::interp::ByteCodeEmitter::compileFunc().