Go to the documentation of this file.
17 #ifndef LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H
18 #define LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H
42 typedef std::map<DocNode, DocNode>
MapTy;
155 if (Lhs.KindAndDoc != Rhs.KindAndDoc) {
181 return !(Lhs < Rhs) && !(Rhs < Lhs);
186 return !(Lhs == Rhs);
214 void convertToArray();
228 MapTy::iterator
end() {
return Map->end(); }
231 MapTy::iterator
erase(MapTy::const_iterator
I) {
return Map->erase(
I); }
233 MapTy::iterator
erase(MapTy::const_iterator First,
234 MapTy::const_iterator Second) {
275 std::vector<std::unique_ptr<DocNode::MapTy>> Maps;
276 std::vector<std::unique_ptr<DocNode::ArrayTy>> Arrays;
277 std::vector<std::unique_ptr<char[]>> Strings;
286 bool HexMode =
false;
292 KindAndDocs[
T] = {
this,
Type(
T)};
374 Maps.push_back(std::unique_ptr<DocNode::MapTy>(
new DocNode::MapTy));
375 N.Map = Maps.back().get();
383 N.Array = Arrays.back().get();
423 Strings.push_back(std::unique_ptr<
char[]>(
new char[
S.size()]));
424 memcpy(&Strings.back()[0],
S.data(),
S.size());
425 return StringRef(&Strings.back()[0],
S.size());
444 #endif // LLVM_BINARYFORMAT_MSGPACKDOCUMENT_H
MapDocNode & getMap(bool Convert=false)
Get a MapDocNode for a map node.
This is an optimization pass for GlobalISel generic memory operations.
DocNode getNode(const char *V, bool Copy=false)
Create a String node associated with this Document.
void push_back(DocNode N)
DocNode getNode(uint64_t V)
Create a UInt node associated with this Document.
DocNode getNode(unsigned V)
Create a UInt node associated with this Document.
Document * getDocument() const
friend bool operator==(const DocNode &Lhs, const DocNode &Rhs)
Equality operator.
DocNode & operator[](StringRef S)
Member access.
MapTy::iterator erase(MapTy::const_iterator First, MapTy::const_iterator Second)
bool readFromBlob(StringRef Blob, bool Multi, function_ref< int(DocNode *DestNode, DocNode SrcNode, DocNode MapKey)> Merger=[](DocNode *DestNode, DocNode SrcNode, DocNode MapKey) { return -1;})
Read a document from a binary msgpack blob, merging into anything already in the Document.
DocNode getNode(StringRef V, bool Copy=false)
Create a String node associated with this Document.
DocNode getNode(bool V)
Create a Boolean node associated with this Document.
A node in a MsgPack Document.
ArrayDocNode getArrayNode()
Create an empty Array node associated with this Document.
StringRef getString() const
MapTy::iterator find(DocNode Key)
into llvm powi allowing the code generator to produce balanced multiplication trees First
friend bool operator!=(const DocNode &Lhs, const DocNode &Rhs)
Inequality operator.
Simple in-memory representation of a document of msgpack objects with ability to find and create arra...
This class implements an extremely fast bulk output stream that can only output to a stream.
bool fromYAML(StringRef S)
Read YAML text into the MsgPack document. Returns false on failure.
std::string toString() const
Convert this node to a string, assuming it is scalar.
The kind of a DocNode and its owning Document.
An efficient, type-erasing, non-owning reference to a callable.
ArrayTy::iterator begin()
std::vector< DocNode > ArrayTy
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
size_t erase(DocNode Key)
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
DocNode getNode(double V)
Create a Float node associated with this Document.
DocNode getNode()
Create a nil node associated with this Document.
std::map< DocNode, DocNode > MapTy
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MapTy::iterator erase(MapTy::const_iterator I)
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
void clear()
Restore the Document to an empty state.
friend bool operator<(const DocNode &Lhs, const DocNode &Rhs)
Comparison operator, used for map keys.
void writeToBlob(std::string &Blob)
Write a MsgPack document to a binary MsgPack blob.
bool getHexMode() const
Get Hexmode flag.
DocNode getEmptyNode()
Create an empty node associated with this Document.
StringRef fromString(StringRef S, StringRef Tag="")
Convert the StringRef and use it to set this DocNode (assuming scalar).
void toYAML(raw_ostream &OS)
Convert MsgPack Document to YAML text.
DocNode getNode(int V)
Create an Int node associated with this Document.
ArrayDocNode & getArray(bool Convert=false)
Get an ArrayDocNode for an array node.
A DocNode that is an array.
MapDocNode getMapNode()
Create an empty Map node associated with this Document.
DocNode getNode(int64_t V)
Create an Int node associated with this Document.
DocNode & getRoot()
Get ref to the document's root element.
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
void setHexMode(bool Val=true)
Set whether YAML output uses hex for UInt. Default off.
DocNode & operator[](size_t Index)
Element access. This extends the array if necessary, with empty nodes.
DocNode & operator=(const char *Val)
Convenience assignment operators.
StringRef addString(StringRef S)
Copy a string into the Document's strings list, and return the copy that is owned by the Document.