19#include "llvm/Support/Compiler.h"
20#include "llvm/Support/Format.h"
26 if constexpr (std::is_pointer_v<T>) {
27 uint32_t ID = OpPC.
read<uint32_t>();
28 return reinterpret_cast<T
>(
P.getNativePointer(ID));
30 return OpPC.
read<T>();
40LLVM_DUMP_METHOD
void Function::dump()
const {
dump(llvm::errs()); }
42LLVM_DUMP_METHOD
void Function::dump(llvm::raw_ostream &OS)
const {
43 OS <<
getName() <<
" " << (
const void *)
this <<
"\n";
44 OS <<
"frame size: " << getFrameSize() <<
"\n";
45 OS <<
"arg size: " << getArgSize() <<
"\n";
46 OS <<
"rvo: " << hasRVO() <<
"\n";
47 OS <<
"this arg: " << hasThisPointer() <<
"\n";
49 auto PrintName = [&OS](
const char *Name) {
51 long N = 30 - strlen(Name);
56 for (
CodePtr Start = getCodeBegin(), PC = Start; PC != getCodeEnd();) {
57 size_t Addr = PC - Start;
58 auto Op = PC.read<
Opcode>();
59 OS << llvm::format(
"%8d", Addr) <<
" ";
72 OS <<
"Global Variables: " << Globals.size() <<
"\n";
73 OS <<
"Functions: " << Funcs.size() <<
"\n";
75 for (
auto &
Func : Funcs) {
78 for (
auto &Anon : AnonFuncs) {
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Floating ReadArg< Floating >(Program &P, CodePtr &OpPC)
T ReadArg(Program &P, CodePtr &OpPC)
static std::string getName(const CallEvent &Call)
Pointer into the code segment.
std::enable_if_t<!std::is_pointer< T >::value, T > read()
Reads data and advances the pointer.
static Floating deserialize(const std::byte *Buff)
size_t bytesToSerialize() const
The program contains and links the bytecode for all functions.
void dump() const
Dumps the disassembled bytecode to llvm::errs().
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.