9#ifndef LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H
10#define LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H
27 std::string AggregateString;
31 size_t size()
const {
return AggregateString.size(); }
35 StringOffset.
insert(std::make_pair(Str, AggregateString.size()));
36 if (IterBool.second) {
38 AggregateString.append(Str.begin(), Str.end());
40 AggregateString +=
'\0';
43 return IterBool.first->second;
49 auto II = StringOffset.
find(Str);
50 if (
II == StringOffset.
end())
59 AggregateString = std::string(Str);
62 unsigned CharsPrinted = 0;
63 for (
unsigned i = 0, e = AggregateString.size(); i != e; ++i) {
64 if (CharsPrinted > 70) {
68 O << AggregateString[i];
72 if (AggregateString[i] !=
'\\')
75 assert(i + 1 < AggregateString.size() &&
"Incomplete escape sequence!");
76 if (isdigit(AggregateString[i + 1])) {
77 assert(isdigit(AggregateString[i + 2]) &&
78 isdigit(AggregateString[i + 3]) &&
79 "Expected 3 digit octal escape!");
80 O << AggregateString[++i];
81 O << AggregateString[++i];
82 O << AggregateString[++i];
85 O << AggregateString[++i];
95 assert(AggregateString.find(
')') == std::string::npos &&
96 "can't emit raw string with closing parens");
99 for (
char C : AggregateString) {
This file defines the StringMap class.
uint64_t IntrinsicInst * II
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
iterator find(StringRef Key)
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
StringRef - Represent a constant reference to a string, i.e.
StringToOffsetTable - This class uniques a bunch of nul-terminated strings and keeps track of their o...
void EmitCharArray(raw_ostream &O)
Emit the string using character literals.
unsigned GetOrAddStringOffset(StringRef Str, bool appendZero=true)
std::optional< unsigned > GetStringOffset(StringRef Str) const
void EmitString(raw_ostream &O)
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '\t', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an esca...
A raw_ostream that writes to an SmallVector or SmallString.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.