20void NamedValuesSchema::anchor() {}
24 if (
Node.getNumReferences() < 1)
27 auto FirstRef =
Node.getReference(0);
28 return FirstRef == *NamedValuesKindRef;
39 NamedValuesKindRef = *Kind;
44 NamedValuesSchema S(CAS, E);
51 return Values.getNumReferences() - 1;
54Error NamedValuesSchema::forEachEntry(
57 for (
size_t I = 0, IE = getNumEntries(
Values);
I != IE; ++
I)
73 StringRef Name)
const {
74 size_t NumNames = getNumEntries(
Values);
80 const size_t MaxLinearSearchSize = 4;
81 size_t Last = NumNames;
83 while (
Last -
First > MaxLinearSearchSize) {
85 StringRef NameI =
Values.getName(
I);
86 switch (
Name.compare(NameI)) {
109 return Node.takeError();
117 "object does not conform to NamedValuesSchema");
150 for (
auto &Entry : Sorted) {
151 Writer.
write(StrIdx);
152 StrIdx += Entry.Name.size();
158 Writer.
write(StrIdx);
161 for (
auto &Entry : Sorted)
166 return Proxy.takeError();
173 Nodes.emplace_back(Saver.
save(Name),
Ref);
179 return Schema.takeError();
180 return Schema->construct(Nodes);
AMDGPU Mark last scratch load
This file contains the declarations for the NamedValuesSchema, a schema to represent an array of name...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Helper for Errors used as out-parameters.
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.
Inheritance utility for extensible RTTI.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Represent a constant reference to a string, i.e.
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
StringRef save(const char *S)
A proxy for a loaded CAS Object in NamedValuesSchema.
LLVM_ABI StringRef getName(size_t I) const
Get the name of an entry by index.
LLVM_ABI void add(StringRef Name, ObjectRef Ref)
Add an entry to the builder.
LLVM_ABI Expected< NamedValuesProxy > build()
Build the node from added entries.
A schema for representing an array of named nodes in a CAS.
Expected< NamedValuesProxy > load(ObjectRef Object) const
Load NamedValuesProxy from an ObjectRef.
friend class NamedValuesProxy
static Expected< NamedValuesSchema > create(ObjectStore &CAS)
Create a NamedValuesSchema.
Expected< NamedValuesProxy > construct(ArrayRef< NamedValuesEntry > Entries)
Construct a NamedValuesSchema CAS object with the given entries.
bool isNode(const ObjectProxy &Node) const final
Check if a proxy represents a valid node.
Reference to an abstract hierarchical node, with data and references.
StringRef getData() const
Get the content of the node. Valid as long as the CAS is valid.
Reference to an object in an ObjectStore instance.
Content-addressable storage for objects.
Expected< ObjectProxy > createProxy(ArrayRef< ObjectRef > Refs, StringRef Data)
Helper functions to store object and returns a ObjectProxy.
Expected< ObjectRef > storeFromString(ArrayRef< ObjectRef > Refs, StringRef String)
Store object from StringRef.
Expected< ObjectProxy > getProxy(const CASID &ID)
Create ObjectProxy from CASID. If the object doesn't exist, get an error.
An efficient, type-erasing, non-owning reference to a callable.
A raw_ostream that writes to an SmallVector or SmallString.
uint32_t read32le(const void *P)
This is an optimization pass for GlobalISel generic memory operations.
void stable_sort(R &&Range)
RelativeUniformCounterPtr Values
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
auto unique(Range &&R, Predicate P)
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
@ Ref
The access may reference the value stored in memory.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
Represents an entry in NamedValuesSchema.
Adapter to write values to a stream in a particular byte order.
void write(ArrayRef< value_type > Val)