20void CASContext::anchor() {}
21void ObjectStore::anchor() {}
34 uint64_t InternalRef, std::optional<CASID>
ID) {
35 OS << Kind <<
"=" << InternalRef;
37 OS <<
"[" << *
ID <<
"]";
48 std::optional<CASID>
ID;
49#if LLVM_ENABLE_ABI_BREAKING_CHECKS
51 ID = CAS->getID(This);
57 std::optional<ObjectHandle> Handle;
66std::unique_ptr<MemoryBuffer>
68 bool RequiresNullTerminator) {
70 toStringRef(
getData(Node, RequiresNullTerminator)),
Name,
71 RequiresNullTerminator);
91 std::optional<ObjectHandle>
H;
100 std::optional<ObjectHandle>
H;
110 "unknown object '" +
ID.toString() +
"'");
117 return Ref.takeError();
123 std::optional<sys::fs::file_status>
Status) {
131 return store({}, arrayRefFromStringRef<char>((*Buffer)->getBuffer()));
139 while (!RefsToValidate.
empty()) {
141 auto [
I, Inserted] = ValidatedRefs.
insert(
Ref);
158std::unique_ptr<MemoryBuffer>
160 bool RequiresNullTerminator)
const {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Mark last scratch load
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the DenseSet and SmallDenseSet classes.
static void printReferenceBase(raw_ostream &OS, StringRef Kind, uint64_t InternalRef, std::optional< CASID > ID)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getOpenFile(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Given an already-open file descriptor, read the file and return a MemoryBuffer.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
Implements a dense probed hash-table based set with some number of buckets stored inline.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Unique identifier for a CAS object.
void print(raw_ostream &OS) const
Print CASID.
std::string toString() const
Return a printable string for CASID.
Handle to a loaded object in a ObjectStore instance.
void print(raw_ostream &OS) const
Print internal ref and/or CASID. Only suitable for debugging.
LLVM_DUMP_METHOD void dump() const
static ObjectProxy load(ObjectStore &CAS, ObjectRef Ref, ObjectHandle Node)
std::unique_ptr< MemoryBuffer > getMemoryBuffer(StringRef Name="", bool RequiresNullTerminator=true) const
Reference to an object in an ObjectStore instance.
void print(raw_ostream &OS) const
Print internal ref and/or CASID. Only suitable for debugging.
LLVM_DUMP_METHOD void dump() const
Expected< ObjectHandle > load(ObjectRef Ref)
Like loadIfExists but returns an error if the object is missing.
Expected< ObjectProxy > createProxy(ArrayRef< ObjectRef > Refs, StringRef Data)
Helper functions to store object and returns a ObjectProxy.
Expected< std::optional< ObjectProxy > > getProxyIfExists(ObjectRef Ref)
virtual Expected< ObjectRef > store(ArrayRef< ObjectRef > Refs, ArrayRef< char > Data)=0
Store object into ObjectStore.
virtual ArrayRef< char > getData(ObjectHandle Node, bool RequiresNullTerminator=false) const =0
virtual CASID getID(ObjectRef Ref) const =0
Get an ID for Ref.
static Error createUnknownObjectError(const CASID &ID)
virtual Expected< std::optional< ObjectHandle > > loadIfExists(ObjectRef Ref)=0
Load the object referenced by Ref.
virtual Error validate(const CASID &ID)=0
Validate the underlying object referred by CASID.
Error validateTree(ObjectRef Ref)
Validate the whole node tree.
virtual Expected< ObjectRef > storeFromOpenFileImpl(sys::fs::file_t FD, std::optional< sys::fs::file_status > Status)
Get ObjectRef from open file.
virtual void readRefs(ObjectHandle Node, SmallVectorImpl< ObjectRef > &Refs) const
Read all the refs from object in a SmallVector.
std::unique_ptr< MemoryBuffer > getMemoryBuffer(ObjectHandle Node, StringRef Name="", bool RequiresNullTerminator=true)
Get a lifetime-extended MemoryBuffer pointing at Data.
virtual std::optional< ObjectRef > getReference(const CASID &ID) const =0
Get an existing reference to the object called ID.
Expected< ObjectProxy > getProxy(const CASID &ID)
Create ObjectProxy from CASID. If the object doesn't exist, get an error.
virtual Error forEachRef(ObjectHandle Node, function_ref< Error(ObjectRef)> Callback) const =0
Methods for handling objects.
void print(raw_ostream &OS, const ObjectHandle &This) const
std::pair< iterator, bool > insert(const ValueT &V)
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
@ Ref
The access may reference the value stored in memory.
const char * toString(DWARFSectionKind Kind)
LLVM_ABI Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
void consumeError(Error Err)
Consume a Error without doing anything.