9 #ifndef LLVM_SUPPORT_SCOPEDPRINTER_H 10 #define LLVM_SUPPORT_SCOPEDPRINTER_H 49 : Value(static_cast<
unsigned long long>(Value)) {}
74 void indent(
int Levels = 1) { IndentLevel += Levels; }
77 IndentLevel =
std::max(0, IndentLevel - Levels);
88 for (
int i = 0; i < IndentLevel; ++i)
94 template <
typename T,
typename TEnum>
99 for (
const auto &EnumItem : EnumValues) {
100 if (EnumItem.Value == Value) {
101 Name = EnumItem.Name;
108 startLine() << Label <<
": " << Name <<
" (" << hex(Value) <<
")\n";
110 startLine() << Label <<
": " << hex(Value) <<
"\n";
114 template <
typename T,
typename TFlag>
116 TFlag EnumMask1 = {}, TFlag EnumMask2 = {},
117 TFlag EnumMask3 = {}) {
122 for (
const auto &
Flag : Flags) {
127 if (
Flag.Value & EnumMask1)
128 EnumMask = EnumMask1;
129 else if (
Flag.Value & EnumMask2)
130 EnumMask = EnumMask2;
131 else if (
Flag.Value & EnumMask3)
132 EnumMask = EnumMask3;
133 bool IsEnum = (
Flag.Value & EnumMask) != 0;
134 if ((!IsEnum && (Value &
Flag.Value) ==
Flag.Value) ||
135 (IsEnum && (Value & EnumMask) ==
Flag.Value)) {
142 startLine() << Label <<
" [ (" << hex(Value) <<
")\n";
143 for (
const auto &
Flag : SetFlags) {
144 startLine() <<
" " <<
Flag.Name <<
" (" << hex(
Flag.Value) <<
")\n";
146 startLine() <<
"]\n";
150 startLine() << Label <<
" [ (" << hex(Value) <<
")\n";
152 uint64_t Curr =
Value;
155 startLine() <<
" " << hex(Flag) <<
"\n";
159 startLine() <<
"]\n";
163 startLine() << Label <<
": " << Value <<
"\n";
167 startLine() << Label <<
": " << Value <<
"\n";
171 startLine() << Label <<
": " << Value <<
"\n";
175 startLine() << Label <<
": " <<
unsigned(Value) <<
"\n";
179 startLine() << Label <<
": " << Value <<
"\n";
183 startLine() << Label <<
": " << Value <<
"\n";
187 startLine() << Label <<
": " << Value <<
"\n";
191 startLine() << Label <<
": " << int(Value) <<
"\n";
195 startLine() << Label <<
": " << Value <<
"\n";
199 startLine() << Label <<
": " << (Value ?
"Yes" :
"No") <<
'\n';
203 startLine() << Label <<
": ";
204 printVersionInternal(
Version...);
205 getOStream() <<
"\n";
209 startLine() << Label <<
": [";
211 for (
const auto &Item : List) {
220 template <
typename T,
typename U>
222 startLine() << Label <<
": [";
224 for (
const auto &Item : List) {
234 startLine() << Label <<
": [";
236 for (
const auto &Item : List) {
246 startLine() << Label <<
": " << hex(Value) <<
"\n";
250 startLine() << Label <<
": " << Str <<
" (" << hex(Value) <<
")\n";
253 template <
typename T>
255 startLine() << Label <<
": " << Symbol <<
'+' << hex(Value) <<
'\n';
261 startLine() << Label <<
": " << Value <<
"\n";
272 template <
typename T>
274 startLine() << Label <<
": " << Str <<
" (" << Value <<
")\n";
278 printBinaryImpl(Label, Str, Value,
false);
284 printBinaryImpl(Label, Str, V,
false);
288 printBinaryImpl(Label,
StringRef(), Value,
false);
294 printBinaryImpl(Label,
StringRef(), V,
false);
300 printBinaryImpl(Label,
StringRef(), V,
false);
305 printBinaryImpl(Label,
StringRef(), Value,
true, StartOffset);
309 printBinaryImpl(Label,
StringRef(), Value,
true);
315 printBinaryImpl(Label,
StringRef(), V,
true);
319 startLine() << Label <<
": " << Value <<
"\n";
330 template <
typename T>
void printVersionInternal(
T Value) {
331 getOStream() <<
Value;
334 template <
typename S,
typename T,
typename... TArgs>
335 void printVersionInternal(S Value, T Value2, TArgs...
Args) {
336 getOStream() << Value <<
".";
337 printVersionInternal(Value2,
Args...);
340 template <
typename T>
346 bool Block,
uint32_t StartOffset = 0);
355 ScopedPrinter::printHex<support::ulittle16_t>(
StringRef Label,
357 startLine() << Label <<
": " << hex(
Value) <<
"\n";
360 template<
char Open,
char Close>
377 W.startLine() << Close <<
'\n';
void printHexList(StringRef Label, const T &List)
HexNumber(signed long Value)
void printEnum(StringRef Label, T Value, ArrayRef< EnumEntry< TEnum >> EnumValues)
This class represents lattice values for constants.
void printBinary(StringRef Label, ArrayRef< char > Value)
void printBinary(StringRef Label, StringRef Value)
void printSymbolOffset(StringRef Label, StringRef Symbol, T Value)
void printBoolean(StringRef Label, bool Value)
void push_back(const T &Elt)
HexNumber(signed char Value)
void printNumber(StringRef Label, int32_t Value)
print alias Alias Set Printer
void printString(StringRef Label, StringRef Value)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
void indent(int Levels=1)
DelimitedScope(ScopedPrinter &W)
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
HexNumber(signed short Value)
void printString(StringRef Label, const char *Value)
raw_ostream & getOStream()
EnumEntry(StringRef N, StringRef A, T V)
void printBinary(StringRef Label, StringRef Str, ArrayRef< uint8_t > Value)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LLVM_NODISCARD size_t size() const
size - Get the string size.
void printNumber(StringRef Label, uint8_t Value)
void printFlags(StringRef Label, T Value)
void printBinary(StringRef Label, StringRef Str, ArrayRef< char > Value)
void printBinaryBlock(StringRef Label, StringRef Value)
Flag
These should be considered private to the implementation of the MCInstrDesc class.
HexNumber(unsigned char Value)
void printString(StringRef Label, const std::string &Value)
HexNumber(unsigned short Value)
size_t size() const
size - Get the array size.
HexNumber(signed int Value)
raw_ostream & startLine()
void printNumber(StringRef Label, const APSInt &Value)
void printList(StringRef Label, const T &List)
void printVersion(StringRef Label, T... Version)
EnumEntry(StringRef N, T V)
HexNumber(signed long long Value)
void printHex(StringRef Label, T Value)
HexNumber(unsigned int Value)
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
void sort(IteratorTy Start, IteratorTy End)
void printNumber(StringRef Label, uint32_t Value)
void printString(StringRef Value)
void printNumber(StringRef Label, uint64_t Value)
Align max(MaybeAlign Lhs, Align Rhs)
DelimitedScope(ScopedPrinter &W, StringRef N)
void printObject(StringRef Label, const T &Value)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void printNumber(StringRef Label, int8_t Value)
void printBinary(StringRef Label, ArrayRef< uint8_t > Value)
void printNumber(StringRef Label, int16_t Value)
const std::string to_hexString(uint64_t Value, bool UpperCase=true)
HexNumber(unsigned long Value)
void printHex(StringRef Label, StringRef Str, T Value)
void setPrefix(StringRef P)
void unindent(int Levels=1)
void printFlags(StringRef Label, T Value, ArrayRef< EnumEntry< TFlag >> Flags, TFlag EnumMask1={}, TFlag EnumMask2={}, TFlag EnumMask3={})
ScopedPrinter(raw_ostream &OS)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
void printNumber(StringRef Label, uint16_t Value)
const std::string to_string(const T &Value)
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void printList(StringRef Label, const T &List, const U &Printer)
void printBinaryBlock(StringRef Label, ArrayRef< uint8_t > Value, uint32_t StartOffset)
A raw_ostream that writes to an std::string.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
void printNumber(StringRef Label, int64_t Value)
void printNumber(StringRef Label, StringRef Str, T Value)
HexNumber(unsigned long long Value)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
void printBinaryBlock(StringRef Label, ArrayRef< uint8_t > Value)