401 lines · plain
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3Visual Studio Native Debugging Visualizers for LLVM
4
5For Visual Studio 2013 only, put this file into
6"%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically.
7
8For later versions of Visual Studio, no setup is required.
9-->
10<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
11 <Type Name="llvm::SmallVectorImpl<*>">
12 <DisplayString Condition="Size == 0">empty</DisplayString>
13 <DisplayString Condition="Size && Size < 4">{(value_type*)BeginX,[Size]}</DisplayString>
14 <DisplayString Condition="Size > 3">{Size} elements</DisplayString>
15 <DisplayString>Uninitialized</DisplayString>
16 <Expand>
17 <Item Name="[size]">Size</Item>
18 <Item Name="[capacity]">Capacity</Item>
19 <ArrayItems>
20 <Size>Size</Size>
21 <ValuePointer>(value_type*)BeginX</ValuePointer>
22 </ArrayItems>
23 </Expand>
24 </Type>
25 <Type Name="llvm::APInt">
26 <!-- For now, only handle up to 64-bit unsigned ints -->
27 <DisplayString Condition="BitWidth <= 64">{U.VAL}</DisplayString>
28 <DisplayString>Cannot visualize APInts longer than 64 bits</DisplayString>
29 </Type>
30 <Type Name="llvm::ArrayRef<*>">
31 <DisplayString Condition="Length < 4">{Data,[Length]}</DisplayString>
32 <DisplayString Condition="Length > 3">{Length} elements</DisplayString>
33 <DisplayString>Uninitialized</DisplayString>
34 <Expand>
35 <Item Name="[size]">Length</Item>
36 <ArrayItems>
37 <Size>Length</Size>
38 <ValuePointer>Data</ValuePointer>
39 </ArrayItems>
40 </Expand>
41 </Type>
42 <Type Name="llvm::SmallString<*>">
43 <DisplayString>{(const char*)BeginX,[Size]s8}</DisplayString>
44 <StringView>(const char*)BeginX,[Size]</StringView>
45 <Expand>
46 <Item Name="[size]">Size</Item>
47 <Item Name="[capacity]">Capacity</Item>
48 <ArrayItems>
49 <Size>Size</Size>
50 <ValuePointer>(char*)BeginX</ValuePointer>
51 </ArrayItems>
52 </Expand>
53 </Type>
54
55 <Type Name="StringView">
56 <DisplayString>{First,[Last - First]s8}</DisplayString>
57 </Type>
58
59 <Type Name="llvm::StringRef">
60 <DisplayString>{Data,[Length]s8}</DisplayString>
61 <StringView>Data,[Length]s8</StringView>
62 <Expand>
63 <Item Name="[size]">Length</Item>
64 <ArrayItems>
65 <Size>Length</Size>
66 <ValuePointer>Data</ValuePointer>
67 </ArrayItems>
68 </Expand>
69 </Type>
70
71 <Type Name="llvm::PunnedPointer">
72 <DisplayString>{($T1)*(intptr_t *)Data}</DisplayString>
73 </Type>
74
75 <!-- PointerIntPair. In addition to the regular view, it is possible to view
76 just the pointer or just the int. The same code is duplicated from the
77 regular viewer to improve the performance of the common case. Note, we
78 need to specify PointerIntPair<PointerUnion<*>, *> differently because
79 we need to "look through" the PointerUnion to display it. Otherwise, we
80 get errors about ambiguous conversion from uintptr_t to PointerUnion.-->
81 <Type Name="llvm::PointerIntPair<llvm::PointerUnion<*>, *>">
82 <!-- $T1 is the parameter pack of PointerUnion, $T3 is IntBits,
83 $T4 is IntType, $T5 is PtrTraits, and $T6 is Info. -->
84 <DisplayString IncludeView="ptr">{($T1)(*(intptr_t *)Value.Data & $T6::PointerBitMask)}</DisplayString>
85 <DisplayString IncludeView="int">{($T4)((*(intptr_t *)Value.Data >> $T6::IntShift) & $T6::IntMask)}</DisplayString>
86 <DisplayString>{$T6::IntMask}: {($T1)(*(intptr_t *)Value.Data & $T6::PointerBitMask)} [{($T4)((*(intptr_t *)Value.Data >> $T6::IntShift) & $T6::IntMask)}]</DisplayString>
87 <Expand>
88 <Item Name="[ptr]">($T1)(*(intptr_t *)Value.Data & $T6::PointerBitMask)</Item>
89 <Item Name="[int]">($T4)((*(intptr_t *)Value.Data >> $T6::IntShift) & $T6::IntMask)</Item>
90 </Expand>
91 </Type>
92
93 <Type Name="llvm::PointerIntPair<*>">
94 <DisplayString IncludeView="ptr">{($T1)(*(intptr_t *)Value.Data & $T5::PointerBitMask)}</DisplayString>
95 <DisplayString IncludeView="int">{((*(intptr_t *)Value.Data >> $T5::IntShift) & $T5::IntMask)}</DisplayString>
96 <DisplayString>{$T5::IntMask}: {($T1)(*(intptr_t *)Value.Data & $T5::PointerBitMask)} [{((*(intptr_t *)Value.Data >> $T5::IntShift) & $T5::IntMask)}]</DisplayString>
97 <Expand>
98 <Item Name="[ptr]">($T1)(*(intptr_t *)Value.Data & $T5::PointerBitMask)</Item>
99 <Item Name="[int]">((*(intptr_t *)Value.Data >> $T5::IntShift) & $T5::IntMask)</Item>
100 </Expand>
101 </Type>
102 <!-- PointerUnion types -->
103 <Type Name="llvm::pointer_union_detail::PointerUnionMembers<*>">
104 <DisplayString Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">
105 {($T4)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask)}
106 </DisplayString>
107 <DisplayString Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">
108 {($T5)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask)}
109 </DisplayString>
110 <DisplayString>Unexpected index in PointerUnion: {(*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask}</DisplayString>
111 <Expand>
112 <Item Name="[Holds]" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">"$T4",s8b</Item>
113 <Item Name="[Ptr]" Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">
114 ($T4)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask)
115 </Item>
116 <Item Name="[Holds]" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">"$T5",s8b</Item>
117 <Item Name="[Ptr]" Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">
118 ($T5)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask)
119 </Item>
120 </Expand>
121 </Type>
122
123 <Type Name="llvm::iplist<*,*>">
124 <DisplayString Condition="Head == 0">{{ empty }}</DisplayString>
125 <DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString>
126 <Expand>
127 <LinkedListItems>
128 <HeadPointer>Head</HeadPointer>
129 <NextPointer>Next</NextPointer>
130 <ValueNode>this</ValueNode>
131 </LinkedListItems>
132 </Expand>
133 </Type>
134
135 <Type Name="llvm::IntrusiveRefCntPtr<*>">
136 <DisplayString Condition="Obj == 0">empty</DisplayString>
137 <DisplayString Condition="(Obj != 0) && (Obj->RefCount == 1)">RefPtr [1 ref] {*Obj}</DisplayString>
138 <DisplayString Condition="(Obj != 0) && (Obj->RefCount != 1)">RefPtr [{Obj->RefCount} refs] {*Obj}</DisplayString>
139 <Expand>
140 <Item Condition="Obj != 0" Name="[refs]">Obj->RefCount</Item>
141 <ExpandedItem Condition="Obj != 0">Obj</ExpandedItem>
142 </Expand>
143 </Type>
144
145 <Type Name="llvm::SmallPtrSet<*,*>">
146 <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
147 <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
148 <Expand>
149 <Item Name="[size]">NumNonEmpty</Item>
150 <Item Name="[capacity]">CurArraySize</Item>
151 <ArrayItems>
152 <Size>NumNonEmpty</Size>
153 <ValuePointer>($T1*)CurArray</ValuePointer>
154 </ArrayItems>
155 </Expand>
156 </Type>
157
158 <Type Name="llvm::DenseMap<*,*,*>">
159 <DisplayString Condition="NumEntries == 0">empty</DisplayString>
160 <DisplayString Condition="NumEntries != 0">{{ size={NumEntries}, buckets={NumBuckets} }}</DisplayString>
161 <Expand>
162 <Item Name="[size]">NumEntries</Item>
163 <Item Name="[buckets]">NumBuckets</Item>
164 <ArrayItems>
165 <Size>NumBuckets</Size>
166 <ValuePointer>Buckets</ValuePointer>
167 </ArrayItems>
168 </Expand>
169 </Type>
170
171 <Type Name="llvm::StringMap<*,*>">
172 <DisplayString>{{ size={NumItems}, buckets={NumBuckets} }}</DisplayString>
173 <Expand>
174 <Item Name="[size]">NumItems</Item>
175 <Item Name="[buckets]">NumBuckets</Item>
176 <ArrayItems>
177 <Size>NumBuckets</Size>
178 <ValuePointer>(MapEntryTy**)TheTable</ValuePointer>
179 </ArrayItems>
180 </Expand>
181 </Type>
182
183 <Type Name="llvm::StringMapEntry<*>">
184 <DisplayString Condition="keyLength == 0">empty</DisplayString>
185 <DisplayString Condition="keyLength != 0">({this+1,s8}, {second})</DisplayString>
186 <Expand>
187 <Item Name="[key]">this+1,s</Item>
188 <Item Name="[value]" Condition="keyLength != 0">second</Item>
189 </Expand>
190 </Type>
191
192 <Type Name="llvm::Triple">
193 <DisplayString>{Data}</DisplayString>
194 </Type>
195
196 <Type Name="llvm::Expected<*>">
197 <DisplayString Condition="HasError">Error</DisplayString>
198 <DisplayString Condition="!HasError">{*((storage_type *)TStorage.buffer)}</DisplayString>
199 <Expand>
200 <Item Name="[value]" Condition="!HasError">*((storage_type *)TStorage.buffer)</Item>
201 <Item Name="[error]" Condition="HasError">*((error_type *)ErrorStorage.buffer)</Item>
202 </Expand>
203 </Type>
204
205
206 <!-- Since we're in MSVC, we can assume that the system is little endian. Therefore
207 the little and native cases just require a cast. Handle this easy case first. Use
208 a wildcard for the second template argument (the endianness), but we will use a
209 specific value of 0 later on for the big endian to give it priority for being a
210 better match. -->
211 <Type Name="llvm::support::detail::packed_endian_specific_integral<*,*,1>">
212 <DisplayString>{{little endian value = {*(($T1*)(unsigned char *)Value.buffer)} }}</DisplayString>
213 <Expand>
214 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
215 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
216 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
217 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
218 </Expand>
219 </Type>
220
221 <!-- Now handle the hard case of big endian. We need to do the swizzling here, but
222 we need to specialize it based on the size of the value type. -->
223 <Type Name="llvm::support::detail::packed_endian_specific_integral<*,0,1>">
224 <DisplayString Condition="sizeof($T1)==1">{{ big endian value = {*(unsigned char *)Value.buffer} }}</DisplayString>
225 <DisplayString Condition="sizeof($T1)==2">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 8)
226 | ($T1)(*((unsigned char *)Value.buffer+1))} }}</DisplayString>
227 <DisplayString Condition="sizeof($T1)==4">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 24)
228 | (($T1)(*((unsigned char *)Value.buffer+1)) << 16)
229 | (($T1)(*((unsigned char *)Value.buffer+2)) << 8)
230 | ($T1)(*((unsigned char *)Value.buffer+3))} }}</DisplayString>
231 <DisplayString Condition="sizeof($T1)==8">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 56)
232 | (($T1)(*((unsigned char *)Value.buffer+1)) << 48)
233 | (($T1)(*((unsigned char *)Value.buffer+2)) << 40)
234 | (($T1)(*((unsigned char *)Value.buffer+3)) << 32)
235 | (($T1)(*((unsigned char *)Value.buffer+4)) << 24)
236 | (($T1)(*((unsigned char *)Value.buffer+5)) << 16)
237 | (($T1)(*((unsigned char *)Value.buffer+6)) << 8)
238 | ($T1)(*((unsigned char *)Value.buffer+7))} }}</DisplayString>
239 <Expand>
240 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
241 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
242 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
243 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
244 </Expand>
245 </Type>
246 <!-- llvm::Type has two fields, SubclassData and ContainedTys, the meaning of which change depending on the TypeID.
247 This visualiser decodes those fields based on the value of ID.
248 -->
249 <Type Name="llvm::Type">
250 <DisplayString>{ID}</DisplayString>
251 <Expand>
252 <Item Name="ID">ID</Item>
253
254 <Item Name="NumBits" Condition="ID == llvm::Type::TypeID::IntegerTyID">SubclassData</Item>
255
256 <Item Name="ReturnType" Condition="ID == llvm::Type::TypeID::FunctionTyID">*ContainedTys</Item>
257 <Synthetic Name="Arguments" Condition="ID == llvm::Type::TypeID::FunctionTyID">
258 <DisplayString>{NumContainedTys - 1}</DisplayString>
259 <Expand>
260 <ArrayItems>
261 <Size>NumContainedTys - 1</Size>
262 <ValuePointer>ContainedTys + 1</ValuePointer>
263 </ArrayItems>
264 </Expand>
265 </Synthetic>
266 <Item Name="IsVarArg" Condition="ID == llvm::Type::TypeID::FunctionTyID">SubclassData == 1</Item>
267
268 <Item Name="HasBody" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_HasBody) != 0</Item>
269 <Item Name="Packed" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_Packed) != 0</Item>
270 <Item Name="IsLiteral" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_IsLiteral) != 0</Item>
271 <Item Name="IsSized" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_IsSized) != 0</Item>
272 <Synthetic Name="Members" Condition="ID == llvm::Type::TypeID::StructTyID">
273 <DisplayString>{NumContainedTys}</DisplayString>
274 <Expand>
275 <ArrayItems>
276 <Size>NumContainedTys</Size>
277 <ValuePointer>ContainedTys</ValuePointer>
278 </ArrayItems>
279 </Expand>
280 </Synthetic>
281
282 <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ArrayTyID">*ContainedTys</Item>
283 <Item Name="NumElements" Condition="ID == llvm::Type::TypeID::ArrayTyID">((llvm::ArrayType*)this)->NumElements</Item>
284
285 <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">*ContainedTys</Item>
286 <Item Name="NumElements" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item>
287
288 <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">*ContainedTys</Item>
289 <Item Name="MinNumElements" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item>
290
291 <Item Name="AddressSpace" Condition="ID == llvm::Type::TypeID::PointerTyID">SubclassData</Item>
292 <Item Name="PointeeType" Condition="ID == llvm::Type::TypeID::PointerTyID">*ContainedTys</Item>
293
294 <Item Name="Context">Context</Item>
295 </Expand>
296 </Type>
297
298 <Type Name="llvm::ConstantSDNode">
299 <DisplayString>$(Type) {*Value}</DisplayString>
300 </Type>
301
302 <Type Name="llvm::SDNode">
303 <DisplayString>$(Type) {(llvm::ISD::NodeType)this->NodeType}</DisplayString>
304 <Expand>
305 <ArrayItems>
306 <Size>NumOperands</Size>
307 <ValuePointer>OperandList</ValuePointer>
308 </ArrayItems>
309 </Expand>
310 </Type>
311
312 <Type Name="llvm::ConstantInt">
313 <DisplayString>i{Val.BitWidth} {Val.VAL}</DisplayString>
314 </Type>
315
316 <Type Name="llvm::IntegerType">
317 <DisplayString>{IDAndSubclassData >> 8}bit integer type</DisplayString>
318 </Type>
319
320 <Type Name="llvm::Value">
321 <DisplayString Condition="HasName">$(Type) {*VTy} {this->getName()} {SubclassData}</DisplayString>
322 <DisplayString Condition="!HasName">$(Type) {*VTy} anon {SubclassData}</DisplayString>
323 <Expand>
324 <Item Name="[Inst]" Condition="SubclassID > InstructionVal">(Instruction*)this</Item>
325 <Item Name="Operands">(User*)this</Item>
326 <LinkedListItems>
327 <HeadPointer>UseList</HeadPointer>
328 <NextPointer>Next</NextPointer>
329 <ValueNode>Prev.Value & 3 == 3 ? (User*)(this + 1) : (User*)(this + 2)</ValueNode>
330 </LinkedListItems>
331 </Expand>
332 </Type>
333
334 <Type Name="llvm::Use">
335 <Expand>
336 <Item Name="Value">Val</Item>
337 <!--
338 <LinkedListItems>
339 <HeadPointer>this</HeadPointer>
340 <NextPointer>Next</NextPointer>
341 <ValueNode>Prev.Value & 3 == 3 ? (User*)(this + 1) : (User*)(this + 2)</ValueNode>
342 </LinkedListItems>
343 -->
344 </Expand>
345 </Type>
346
347 <!-- uses other values, like Operands -->
348 <Type Name="llvm::User">
349 <DisplayString Condition="HasName">$(Type) {*VTy} {this->getName()} {SubclassData}</DisplayString>
350 <DisplayString Condition="!HasName">$(Type) {*VTy} anon {SubclassData}</DisplayString>
351 <Expand>
352 <Item Name="[Value]">(Value*)this,nd</Item>
353 <Item Name="[Type]">*VTy</Item>
354 <ArrayItems Condition="!HasHungOffUses">
355 <Size>NumUserOperands</Size>
356 <ValuePointer>(llvm::Use*)this - NumUserOperands</ValuePointer>
357 </ArrayItems>
358 <ArrayItems Condition="HasHungOffUses">
359 <Size>NumUserOperands</Size>
360 <ValuePointer>*((llvm::Use**)this - 1)</ValuePointer>
361 </ArrayItems>
362 </Expand>
363 </Type>
364
365 <Type Name="llvm::Instruction">
366 <DisplayString>{getOpcodeName(SubclassID - InstructionVal)}</DisplayString>
367 <Expand>
368 <Item Name="[User]">(User*)this,nd</Item>
369 </Expand>
370 </Type>
371
372 <Type Name="llvm::GlobalValue">
373 <DisplayString>{this->getName()} {(LinkageTypes)Linkage} {(VisibilityTypes)Visibility} {(DLLStorageClassTypes)DllStorageClass} {(llvm::GlobalValue::ThreadLocalMode) ThreadLocal}</DisplayString>
374 </Type>
375
376 <!-- TODO doesn't work cause it doesn't know the dynamic type -->
377 <Type Name="llvm::ilist_node">
378 <Expand>
379 <LinkedListItems>
380 <HeadPointer>this</HeadPointer>
381 <NextPointer>Next</NextPointer>
382 <ValueNode>this</ValueNode>
383 </LinkedListItems>
384 </Expand>
385 </Type>
386
387 <Type Name="llvm::LLVMContext">
388 <Expand>
389 <ExpandedItem>pImpl</ExpandedItem>
390 </Expand>
391 </Type>
392
393 <Type Name="llvm::Module">
394 <DisplayString>{ModuleID,s8} {TargetTriple}</DisplayString>
395 </Type>
396
397 <Type Name="llvm::Pass">
398 <DisplayString>$(Type) {PassID} {Kind}</DisplayString>
399 </Type>
400</AutoVisualizer>
401