Go to the documentation of this file.
16 #ifndef DEMANGLE_UTILITY_H
17 #define DEMANGLE_UTILITY_H
32 char *Buffer =
nullptr;
33 size_t CurrentPosition = 0;
34 size_t BufferCapacity = 0;
38 size_t Need =
N + CurrentPosition;
39 if (Need > BufferCapacity) {
45 if (BufferCapacity < Need)
46 BufferCapacity = Need;
47 Buffer =
static_cast<char *
>(std::realloc(Buffer, BufferCapacity));
48 if (Buffer ==
nullptr)
54 std::array<char, 21> Temp;
55 char *TempPtr = Temp.data() + Temp.size();
59 *--TempPtr = char(
'0' +
N % 10);
72 : Buffer(StartBuf), CurrentPosition(0), BufferCapacity(
Size) {}
80 void reset(
char *Buffer_,
size_t BufferCapacity_) {
83 BufferCapacity = BufferCapacity_;
107 if (
size_t Size =
R.size()) {
110 CurrentPosition +=
Size;
117 Buffer[CurrentPosition++] =
C;
122 size_t Size =
R.size();
125 std::memmove(Buffer +
Size, Buffer, CurrentPosition);
127 CurrentPosition +=
Size;
137 return writeUnsigned(
static_cast<unsigned long long>(
std::abs(
N)),
N < 0);
141 return writeUnsigned(
N,
false);
145 return this->operator<<(static_cast<long long>(
N));
149 return this->operator<<(static_cast<unsigned long long>(
N));
153 return this->operator<<(static_cast<long long>(
N));
157 return this->operator<<(static_cast<unsigned long long>(
N));
161 assert(Pos <= CurrentPosition);
165 std::memmove(Buffer + Pos +
N, Buffer + Pos, CurrentPosition - Pos);
167 CurrentPosition +=
N;
175 return Buffer[CurrentPosition - 1];
178 bool empty()
const {
return CurrentPosition == 0; }
204 if (Buf ==
nullptr) {
205 Buf =
static_cast<char *
>(std::malloc(InitSize));
208 BufferSize = InitSize;
212 OB.reset(Buf, BufferSize);
OutputBuffer & operator+=(StringView R)
size_t getBufferCapacity() const
ScopedOverride(T &Loc_, T NewVal)
ScopedOverride & operator=(const ScopedOverride &)=delete
unsigned GtIsGt
When zero, we're printing template args and '>' needs to be parenthesized.
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
OutputBuffer & operator=(const OutputBuffer &)=delete
OutputBuffer & operator<<(int N)
void insert(size_t Pos, const char *S, size_t N)
void printClose(char Close=')')
OutputBuffer & operator<<(unsigned long N)
OutputBuffer & operator+=(char C)
OutputBuffer & prepend(StringView R)
(vector float) vec_cmpeq(*A, *B) C
void reset(char *Buffer_, size_t BufferCapacity_)
OutputBuffer & operator<<(unsigned int N)
OutputBuffer & operator<<(long N)
void setCurrentPosition(size_t NewPos)
#define DEMANGLE_NAMESPACE_END
OutputBuffer & operator<<(long long N)
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
size_t getCurrentPosition() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputBuffer & operator<<(char C)
<%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(<
unsigned CurrentPackIndex
If a ParameterPackExpansion (or similar type) is encountered, the offset into the pack that we're cur...
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
OutputBuffer & operator<<(unsigned long long N)
bool isGtInsideTemplateArgs() const
bool initializeOutputBuffer(char *Buf, size_t *N, OutputBuffer &OB, size_t InitSize)
OutputBuffer & operator<<(StringView R)
#define DEMANGLE_NAMESPACE_BEGIN
OutputBuffer(char *StartBuf, size_t Size)
APFloat abs(APFloat X)
Returns the absolute value of the argument.
void printOpen(char Open='(')