10 #ifndef LLVM_SUPPORT_SCOPEDPRINTER_H 11 #define LLVM_SUPPORT_SCOPEDPRINTER_H 50 : Value(static_cast<
unsigned long long>(Value)) {}
75 void indent(
int Levels = 1) { IndentLevel += Levels; }
78 IndentLevel =
std::max(0, IndentLevel - Levels);
89 for (
int i = 0; i < IndentLevel; ++i)
95 template <
typename T,
typename TEnum>
100 for (
const auto &EnumItem : EnumValues) {
101 if (EnumItem.Value == Value) {
102 Name = EnumItem.Name;
109 startLine() << Label <<
": " << Name <<
" (" << hex(Value) <<
")\n";
111 startLine() << Label <<
": " << hex(Value) <<
"\n";
115 template <
typename T,
typename TFlag>
117 TFlag EnumMask1 = {}, TFlag EnumMask2 = {},
118 TFlag EnumMask3 = {}) {
123 for (
const auto &
Flag : Flags) {
128 if (
Flag.Value & EnumMask1)
129 EnumMask = EnumMask1;
130 else if (
Flag.Value & EnumMask2)
131 EnumMask = EnumMask2;
132 else if (
Flag.Value & EnumMask3)
133 EnumMask = EnumMask3;
134 bool IsEnum = (
Flag.Value & EnumMask) != 0;
135 if ((!IsEnum && (Value &
Flag.Value) ==
Flag.Value) ||
136 (IsEnum && (Value & EnumMask) ==
Flag.Value)) {
143 startLine() << Label <<
" [ (" << hex(Value) <<
")\n";
144 for (
const auto &
Flag : SetFlags) {
145 startLine() <<
" " <<
Flag.Name <<
" (" << hex(
Flag.Value) <<
")\n";
147 startLine() <<
"]\n";
151 startLine() << Label <<
" [ (" << hex(Value) <<
")\n";
153 uint64_t Curr =
Value;
156 startLine() <<
" " << hex(Flag) <<
"\n";
160 startLine() <<
"]\n";
164 startLine() << Label <<
": " << Value <<
"\n";
168 startLine() << Label <<
": " << Value <<
"\n";
172 startLine() << Label <<
": " << Value <<
"\n";
176 startLine() << Label <<
": " <<
unsigned(Value) <<
"\n";
180 startLine() << Label <<
": " << Value <<
"\n";
184 startLine() << Label <<
": " << Value <<
"\n";
188 startLine() << Label <<
": " << Value <<
"\n";
192 startLine() << Label <<
": " << int(Value) <<
"\n";
196 startLine() << Label <<
": " << Value <<
"\n";
200 startLine() << Label <<
": " << (Value ?
"Yes" :
"No") <<
'\n';
204 startLine() << Label <<
": ";
205 printVersionInternal(
Version...);
206 getOStream() <<
"\n";
210 startLine() << Label <<
": [";
212 for (
const auto &Item : List) {
221 template <
typename T,
typename U>
223 startLine() << Label <<
": [";
225 for (
const auto &Item : List) {
235 startLine() << Label <<
": [";
237 for (
const auto &Item : List) {
247 startLine() << Label <<
": " << hex(Value) <<
"\n";
251 startLine() << Label <<
": " << Str <<
" (" << hex(Value) <<
")\n";
254 template <
typename T>
256 startLine() << Label <<
": " << Symbol <<
'+' << hex(Value) <<
'\n';
262 startLine() << Label <<
": " << Value <<
"\n";
273 template <
typename T>
275 startLine() << Label <<
": " << Str <<
" (" << Value <<
")\n";
279 printBinaryImpl(Label, Str, Value,
false);
285 printBinaryImpl(Label, Str, V,
false);
289 printBinaryImpl(Label,
StringRef(), Value,
false);
295 printBinaryImpl(Label,
StringRef(), V,
false);
301 printBinaryImpl(Label,
StringRef(), V,
false);
306 printBinaryImpl(Label,
StringRef(), Value,
true, StartOffset);
310 printBinaryImpl(Label,
StringRef(), Value,
true);
316 printBinaryImpl(Label,
StringRef(), V,
true);
320 startLine() << Label <<
": " << Value <<
"\n";
331 template <
typename T>
void printVersionInternal(
T Value) {
332 getOStream() <<
Value;
335 template <
typename S,
typename T,
typename... TArgs>
336 void printVersionInternal(S Value, T Value2, TArgs...
Args) {
337 getOStream() << Value <<
".";
338 printVersionInternal(Value2,
Args...);
341 template <
typename T>
347 bool Block,
uint32_t StartOffset = 0);
356 ScopedPrinter::printHex<support::ulittle16_t>(
StringRef Label,
358 startLine() << Label <<
": " << hex(
Value) <<
"\n";
361 template<
char Open,
char Close>
378 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)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
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)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
HexNumber(signed char Value)
void printNumber(StringRef Label, int32_t Value)
print alias Alias Set Printer
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
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)
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)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
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)
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)
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)