blob: 9a1f966c8d003a8a974dd7abdae4c72a481fb6d5 [file] [log] [blame]
Eric Christopher0d27ca12013-08-08 23:45:55 +00001//===-- llvm/CodeGen/DIEHash.cpp - Dwarf Hashing Framework ----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains support for DWARF4 hashing of DIEs.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "dwarfdebug"
15
16#include "DIE.h"
17#include "DIEHash.h"
18#include "DwarfCompileUnit.h"
19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/Support/Debug.h"
22#include "llvm/Support/Dwarf.h"
23#include "llvm/Support/Endian.h"
24#include "llvm/Support/MD5.h"
25#include "llvm/Support/raw_ostream.h"
26
27using namespace llvm;
28
29/// \brief Grabs the string in whichever attribute is passed in and returns
30/// a reference to it.
31static StringRef getDIEStringAttr(DIE *Die, uint16_t Attr) {
32 const SmallVectorImpl<DIEValue *> &Values = Die->getValues();
33 const DIEAbbrev &Abbrevs = Die->getAbbrev();
34
35 // Iterate through all the attributes until we find the one we're
36 // looking for, if we can't find it return an empty string.
37 for (size_t i = 0; i < Values.size(); ++i) {
38 if (Abbrevs.getData()[i].getAttribute() == Attr) {
39 DIEValue *V = Values[i];
40 assert(isa<DIEString>(V) && "String requested. Not a string.");
41 DIEString *S = cast<DIEString>(V);
42 return S->getString();
43 }
44 }
45 return StringRef("");
46}
47
48/// \brief Adds the string in \p Str to the hash. This also hashes
49/// a trailing NULL with the string.
50void DIEHash::addString(StringRef Str) {
51 DEBUG(dbgs() << "Adding string " << Str << " to hash.\n");
52 Hash.update(Str);
53 Hash.update(makeArrayRef((uint8_t)'\0'));
54}
55
56// FIXME: The LEB128 routines are copied and only slightly modified out of
57// LEB128.h.
58
59/// \brief Adds the unsigned in \p Value to the hash encoded as a ULEB128.
60void DIEHash::addULEB128(uint64_t Value) {
61 DEBUG(dbgs() << "Adding ULEB128 " << Value << " to hash.\n");
62 do {
63 uint8_t Byte = Value & 0x7f;
64 Value >>= 7;
65 if (Value != 0)
66 Byte |= 0x80; // Mark this byte to show that more bytes will follow.
67 Hash.update(Byte);
68 } while (Value != 0);
69}
70
David Blaikiec0987082013-10-16 23:36:20 +000071void DIEHash::addSLEB128(int64_t Value) {
72 DEBUG(dbgs() << "Adding ULEB128 " << Value << " to hash.\n");
73 bool More;
74 do {
75 uint8_t Byte = Value & 0x7f;
76 Value >>= 7;
77 More = !((((Value == 0 ) && ((Byte & 0x40) == 0)) ||
78 ((Value == -1) && ((Byte & 0x40) != 0))));
79 if (More)
80 Byte |= 0x80; // Mark this byte to show that more bytes will follow.
81 Hash.update(Byte);
82 } while (More);
83}
84
Eric Christopher0d27ca12013-08-08 23:45:55 +000085/// \brief Including \p Parent adds the context of Parent to the hash..
86void DIEHash::addParentContext(DIE *Parent) {
87
88 DEBUG(dbgs() << "Adding parent context to hash...\n");
89
90 // [7.27.2] For each surrounding type or namespace beginning with the
91 // outermost such construct...
92 SmallVector<DIE *, 1> Parents;
93 while (Parent->getTag() != dwarf::DW_TAG_compile_unit) {
94 Parents.push_back(Parent);
95 Parent = Parent->getParent();
96 }
97
98 // Reverse iterate over our list to go from the outermost construct to the
99 // innermost.
100 for (SmallVectorImpl<DIE *>::reverse_iterator I = Parents.rbegin(),
101 E = Parents.rend();
102 I != E; ++I) {
103 DIE *Die = *I;
104
105 // ... Append the letter "C" to the sequence...
106 addULEB128('C');
107
108 // ... Followed by the DWARF tag of the construct...
109 addULEB128(Die->getTag());
110
111 // ... Then the name, taken from the DW_AT_name attribute.
112 StringRef Name = getDIEStringAttr(Die, dwarf::DW_AT_name);
113 DEBUG(dbgs() << "... adding context: " << Name << "\n");
114 if (!Name.empty())
115 addString(Name);
116 }
117}
118
Eric Christopher0710bfa2013-08-13 01:21:55 +0000119// Collect all of the attributes for a particular DIE in single structure.
David Blaikiecbb5c732013-08-14 22:23:05 +0000120void DIEHash::collectAttributes(DIE *Die, DIEAttrs &Attrs) {
Eric Christopher0710bfa2013-08-13 01:21:55 +0000121 const SmallVectorImpl<DIEValue *> &Values = Die->getValues();
122 const DIEAbbrev &Abbrevs = Die->getAbbrev();
123
124#define COLLECT_ATTR(NAME) \
David Blaikie0d87c202013-10-17 22:14:08 +0000125 case dwarf::NAME: \
126 Attrs.NAME.Val = Values[i]; \
127 Attrs.NAME.Desc = &Abbrevs.getData()[i]; \
128 break
Eric Christopher0710bfa2013-08-13 01:21:55 +0000129
130 for (size_t i = 0, e = Values.size(); i != e; ++i) {
131 DEBUG(dbgs() << "Attribute: "
132 << dwarf::AttributeString(Abbrevs.getData()[i].getAttribute())
133 << " added.\n");
134 switch (Abbrevs.getData()[i].getAttribute()) {
David Blaikie0d87c202013-10-17 22:14:08 +0000135 COLLECT_ATTR(DW_AT_name);
136 COLLECT_ATTR(DW_AT_accessibility);
137 COLLECT_ATTR(DW_AT_address_class);
138 COLLECT_ATTR(DW_AT_allocated);
139 COLLECT_ATTR(DW_AT_artificial);
140 COLLECT_ATTR(DW_AT_associated);
141 COLLECT_ATTR(DW_AT_binary_scale);
142 COLLECT_ATTR(DW_AT_bit_offset);
143 COLLECT_ATTR(DW_AT_bit_size);
144 COLLECT_ATTR(DW_AT_bit_stride);
145 COLLECT_ATTR(DW_AT_byte_size);
146 COLLECT_ATTR(DW_AT_byte_stride);
147 COLLECT_ATTR(DW_AT_const_expr);
148 COLLECT_ATTR(DW_AT_const_value);
149 COLLECT_ATTR(DW_AT_containing_type);
150 COLLECT_ATTR(DW_AT_count);
151 COLLECT_ATTR(DW_AT_data_bit_offset);
152 COLLECT_ATTR(DW_AT_data_location);
153 COLLECT_ATTR(DW_AT_data_member_location);
154 COLLECT_ATTR(DW_AT_decimal_scale);
155 COLLECT_ATTR(DW_AT_decimal_sign);
156 COLLECT_ATTR(DW_AT_default_value);
157 COLLECT_ATTR(DW_AT_digit_count);
158 COLLECT_ATTR(DW_AT_discr);
159 COLLECT_ATTR(DW_AT_discr_list);
160 COLLECT_ATTR(DW_AT_discr_value);
161 COLLECT_ATTR(DW_AT_encoding);
162 COLLECT_ATTR(DW_AT_enum_class);
163 COLLECT_ATTR(DW_AT_endianity);
164 COLLECT_ATTR(DW_AT_explicit);
165 COLLECT_ATTR(DW_AT_is_optional);
166 COLLECT_ATTR(DW_AT_location);
167 COLLECT_ATTR(DW_AT_lower_bound);
168 COLLECT_ATTR(DW_AT_mutable);
169 COLLECT_ATTR(DW_AT_ordering);
170 COLLECT_ATTR(DW_AT_picture_string);
171 COLLECT_ATTR(DW_AT_prototyped);
172 COLLECT_ATTR(DW_AT_small);
173 COLLECT_ATTR(DW_AT_segment);
174 COLLECT_ATTR(DW_AT_string_length);
175 COLLECT_ATTR(DW_AT_threads_scaled);
176 COLLECT_ATTR(DW_AT_upper_bound);
177 COLLECT_ATTR(DW_AT_use_location);
178 COLLECT_ATTR(DW_AT_use_UTF8);
179 COLLECT_ATTR(DW_AT_variable_parameter);
180 COLLECT_ATTR(DW_AT_virtuality);
181 COLLECT_ATTR(DW_AT_visibility);
182 COLLECT_ATTR(DW_AT_vtable_elem_location);
183 COLLECT_ATTR(DW_AT_type);
Eric Christopher0710bfa2013-08-13 01:21:55 +0000184 default:
185 break;
186 }
187 }
188}
189
190// Hash an individual attribute \param Attr based on the type of attribute and
191// the form.
David Blaikief1545a22013-10-21 22:36:50 +0000192void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {
Eric Christopher0710bfa2013-08-13 01:21:55 +0000193 const DIEValue *Value = Attr.Val;
194 const DIEAbbrevData *Desc = Attr.Desc;
David Blaikief1962082013-10-22 18:14:41 +0000195 dwarf::Attribute Attribute = Desc->getAttribute();
Eric Christopher0710bfa2013-08-13 01:21:55 +0000196
David Blaikief1545a22013-10-21 22:36:50 +0000197 // 7.27 Step 3
David Blaikie47f66d52013-10-17 22:07:09 +0000198 // ... An attribute that refers to another type entry T is processed as
199 // follows:
David Blaikie47f66d52013-10-17 22:07:09 +0000200 if (const DIEEntry *EntryAttr = dyn_cast<DIEEntry>(Value)) {
201 DIE *Entry = EntryAttr->getEntry();
David Blaikief1545a22013-10-21 22:36:50 +0000202
203 // Step 5
David Blaikief1962082013-10-22 18:14:41 +0000204 // If the tag in Step 3 is one of [the below tags]
205 if ((Tag == dwarf::DW_TAG_pointer_type ||
206 Tag == dwarf::DW_TAG_reference_type ||
207 Tag == dwarf::DW_TAG_rvalue_reference_type ||
208 Tag == dwarf::DW_TAG_ptr_to_member_type) &&
209 // and the referenced type (via the [below attributes])
210 // FIXME: This seems overly restrictive, and causes hash mismatches
211 // there's a decl/def difference in the containing type of a
212 // ptr_to_member_type.
213 Attribute == dwarf::DW_AT_type) {
David Blaikief1545a22013-10-21 22:36:50 +0000214 // [FIXME] ... has a DW_AT_name attribute,
215 // append the letter 'N'
216 addULEB128('N');
217
218 // the DWARF attribute code (DW_AT_type or DW_AT_friend),
219 addULEB128(Desc->getAttribute());
220
221 // the context of the tag,
222 if (DIE *Parent = Entry->getParent())
223 addParentContext(Parent);
224
225 // the letter 'E',
226 addULEB128('E');
227
228 // and the name of the type.
229 addString(getDIEStringAttr(Entry, dwarf::DW_AT_name));
230
231 // FIXME:
232 // For DW_TAG_friend, if the referenced entry is the DW_TAG_subprogram,
233 // the context is omitted and the name to be used is the ABI-specific name
234 // of the subprogram (e.g., the mangled linker name).
235 return;
236 }
237
David Blaikie3baa3c32013-10-21 18:59:40 +0000238 unsigned &DieNumber = Numbering[Entry];
239 if (DieNumber) {
240 // a) If T is in the list of [previously hashed types], use the letter
241 // 'R' as the marker
242 addULEB128('R');
David Blaikie47f66d52013-10-17 22:07:09 +0000243
David Blaikief1962082013-10-22 18:14:41 +0000244 addULEB128(Attribute);
David Blaikie3baa3c32013-10-21 18:59:40 +0000245
246 // and use the unsigned LEB128 encoding of [the index of T in the
247 // list] as the attribute value;
248 addULEB128(DieNumber);
249 return;
250 }
251
252 // otherwise, b) use the letter 'T' as a the marker, ...
David Blaikie47f66d52013-10-17 22:07:09 +0000253 addULEB128('T');
254
David Blaikief1962082013-10-22 18:14:41 +0000255 addULEB128(Attribute);
David Blaikie47f66d52013-10-17 22:07:09 +0000256
257 // ... process the type T recursively by performing Steps 2 through 7, and
258 // use the result as the attribute value.
David Blaikie3baa3c32013-10-21 18:59:40 +0000259 DieNumber = Numbering.size();
David Blaikie47f66d52013-10-17 22:07:09 +0000260 computeHash(Entry);
261 return;
262 }
263
264 // Other attribute values use the letter 'A' as the marker, ...
Eric Christopher0710bfa2013-08-13 01:21:55 +0000265 addULEB128('A');
266
David Blaikief1962082013-10-22 18:14:41 +0000267 addULEB128(Attribute);
David Blaikiec0987082013-10-16 23:36:20 +0000268
David Blaikie47f66d52013-10-17 22:07:09 +0000269 // ... and the value consists of the form code (encoded as an unsigned LEB128
270 // value) followed by the encoding of the value according to the form code. To
271 // ensure reproducibility of the signature, the set of forms used in the
David Blaikiec0987082013-10-16 23:36:20 +0000272 // signature computation is limited to the following: DW_FORM_sdata,
273 // DW_FORM_flag, DW_FORM_string, and DW_FORM_block.
Eric Christopher0710bfa2013-08-13 01:21:55 +0000274 switch (Desc->getForm()) {
David Blaikiec0987082013-10-16 23:36:20 +0000275 case dwarf::DW_FORM_string:
276 llvm_unreachable(
277 "Add support for DW_FORM_string if we ever start emitting them again");
David Blaikieda39dd32013-10-21 16:37:22 +0000278 case dwarf::DW_FORM_GNU_str_index:
Eric Christopher0710bfa2013-08-13 01:21:55 +0000279 case dwarf::DW_FORM_strp:
David Blaikiec0987082013-10-16 23:36:20 +0000280 addULEB128(dwarf::DW_FORM_string);
Eric Christopher0710bfa2013-08-13 01:21:55 +0000281 addString(cast<DIEString>(Value)->getString());
282 break;
Eric Christopher7ced4fa2013-08-28 00:10:38 +0000283 case dwarf::DW_FORM_data1:
284 case dwarf::DW_FORM_data2:
285 case dwarf::DW_FORM_data4:
286 case dwarf::DW_FORM_data8:
287 case dwarf::DW_FORM_udata:
David Blaikiec0987082013-10-16 23:36:20 +0000288 addULEB128(dwarf::DW_FORM_sdata);
289 addSLEB128((int64_t)cast<DIEInteger>(Value)->getValue());
Eric Christopher7ced4fa2013-08-28 00:10:38 +0000290 break;
David Blaikieda39dd32013-10-21 16:37:22 +0000291 default:
292 llvm_unreachable("Add support for additional forms");
Eric Christopher0710bfa2013-08-13 01:21:55 +0000293 }
294}
295
296// Go through the attributes from \param Attrs in the order specified in 7.27.4
297// and hash them.
David Blaikief1545a22013-10-21 22:36:50 +0000298void DIEHash::hashAttributes(const DIEAttrs &Attrs, dwarf::Tag Tag) {
Eric Christopher0710bfa2013-08-13 01:21:55 +0000299#define ADD_ATTR(ATTR) \
300 { \
301 if (ATTR.Val != 0) \
David Blaikief1545a22013-10-21 22:36:50 +0000302 hashAttribute(ATTR, Tag); \
Eric Christopher0710bfa2013-08-13 01:21:55 +0000303 }
304
Eric Christopher0710bfa2013-08-13 01:21:55 +0000305 ADD_ATTR(Attrs.DW_AT_name);
Eric Christopherbd18c8d2013-09-03 20:00:20 +0000306 ADD_ATTR(Attrs.DW_AT_accessibility);
307 ADD_ATTR(Attrs.DW_AT_address_class);
308 ADD_ATTR(Attrs.DW_AT_allocated);
309 ADD_ATTR(Attrs.DW_AT_artificial);
310 ADD_ATTR(Attrs.DW_AT_associated);
311 ADD_ATTR(Attrs.DW_AT_binary_scale);
312 ADD_ATTR(Attrs.DW_AT_bit_offset);
313 ADD_ATTR(Attrs.DW_AT_bit_size);
314 ADD_ATTR(Attrs.DW_AT_bit_stride);
315 ADD_ATTR(Attrs.DW_AT_byte_size);
316 ADD_ATTR(Attrs.DW_AT_byte_stride);
317 ADD_ATTR(Attrs.DW_AT_const_expr);
318 ADD_ATTR(Attrs.DW_AT_const_value);
319 ADD_ATTR(Attrs.DW_AT_containing_type);
320 ADD_ATTR(Attrs.DW_AT_count);
321 ADD_ATTR(Attrs.DW_AT_data_bit_offset);
322 ADD_ATTR(Attrs.DW_AT_data_location);
323 ADD_ATTR(Attrs.DW_AT_data_member_location);
324 ADD_ATTR(Attrs.DW_AT_decimal_scale);
325 ADD_ATTR(Attrs.DW_AT_decimal_sign);
326 ADD_ATTR(Attrs.DW_AT_default_value);
327 ADD_ATTR(Attrs.DW_AT_digit_count);
328 ADD_ATTR(Attrs.DW_AT_discr);
329 ADD_ATTR(Attrs.DW_AT_discr_list);
330 ADD_ATTR(Attrs.DW_AT_discr_value);
331 ADD_ATTR(Attrs.DW_AT_encoding);
332 ADD_ATTR(Attrs.DW_AT_enum_class);
333 ADD_ATTR(Attrs.DW_AT_endianity);
334 ADD_ATTR(Attrs.DW_AT_explicit);
335 ADD_ATTR(Attrs.DW_AT_is_optional);
336 ADD_ATTR(Attrs.DW_AT_location);
337 ADD_ATTR(Attrs.DW_AT_lower_bound);
338 ADD_ATTR(Attrs.DW_AT_mutable);
339 ADD_ATTR(Attrs.DW_AT_ordering);
340 ADD_ATTR(Attrs.DW_AT_picture_string);
341 ADD_ATTR(Attrs.DW_AT_prototyped);
342 ADD_ATTR(Attrs.DW_AT_small);
343 ADD_ATTR(Attrs.DW_AT_segment);
344 ADD_ATTR(Attrs.DW_AT_string_length);
345 ADD_ATTR(Attrs.DW_AT_threads_scaled);
346 ADD_ATTR(Attrs.DW_AT_upper_bound);
347 ADD_ATTR(Attrs.DW_AT_use_location);
348 ADD_ATTR(Attrs.DW_AT_use_UTF8);
349 ADD_ATTR(Attrs.DW_AT_variable_parameter);
350 ADD_ATTR(Attrs.DW_AT_virtuality);
351 ADD_ATTR(Attrs.DW_AT_visibility);
352 ADD_ATTR(Attrs.DW_AT_vtable_elem_location);
David Blaikie47f66d52013-10-17 22:07:09 +0000353 ADD_ATTR(Attrs.DW_AT_type);
Eric Christopherbd18c8d2013-09-03 20:00:20 +0000354
355 // FIXME: Add the extended attributes.
Eric Christopher0710bfa2013-08-13 01:21:55 +0000356}
357
358// Add all of the attributes for \param Die to the hash.
359void DIEHash::addAttributes(DIE *Die) {
David Blaikiee8917752013-10-16 00:47:21 +0000360 DIEAttrs Attrs = {};
David Blaikiecbb5c732013-08-14 22:23:05 +0000361 collectAttributes(Die, Attrs);
David Blaikief1545a22013-10-21 22:36:50 +0000362 hashAttributes(Attrs, Die->getTag());
Eric Christopher0710bfa2013-08-13 01:21:55 +0000363}
364
365// Compute the hash of a DIE. This is based on the type signature computation
366// given in section 7.27 of the DWARF4 standard. It is the md5 hash of a
367// flattened description of the DIE.
368void DIEHash::computeHash(DIE *Die) {
Eric Christopher0710bfa2013-08-13 01:21:55 +0000369 // Append the letter 'D', followed by the DWARF tag of the DIE.
370 addULEB128('D');
371 addULEB128(Die->getTag());
372
373 // Add each of the attributes of the DIE.
374 addAttributes(Die);
375
376 // Then hash each of the children of the DIE.
377 for (std::vector<DIE *>::const_iterator I = Die->getChildren().begin(),
378 E = Die->getChildren().end();
379 I != E; ++I)
380 computeHash(*I);
David Blaikie75ee0002013-10-16 20:29:06 +0000381
382 // Following the last (or if there are no children), append a zero byte.
David Blaikie700b91f2013-10-16 20:40:46 +0000383 Hash.update(makeArrayRef((uint8_t)'\0'));
Eric Christopher0710bfa2013-08-13 01:21:55 +0000384}
385
Eric Christopher0d27ca12013-08-08 23:45:55 +0000386/// This is based on the type signature computation given in section 7.27 of the
387/// DWARF4 standard. It is the md5 hash of a flattened description of the DIE
Eric Christopherdd0cd3c2013-08-12 23:59:24 +0000388/// with the exception that we are hashing only the context and the name of the
389/// type.
Eric Christopher0d27ca12013-08-08 23:45:55 +0000390uint64_t DIEHash::computeDIEODRSignature(DIE *Die) {
391
392 // Add the contexts to the hash. We won't be computing the ODR hash for
393 // function local types so it's safe to use the generic context hashing
394 // algorithm here.
395 // FIXME: If we figure out how to account for linkage in some way we could
396 // actually do this with a slight modification to the parent hash algorithm.
397 DIE *Parent = Die->getParent();
398 if (Parent)
399 addParentContext(Parent);
400
401 // Add the current DIE information.
402
403 // Add the DWARF tag of the DIE.
404 addULEB128(Die->getTag());
405
406 // Add the name of the type to the hash.
407 addString(getDIEStringAttr(Die, dwarf::DW_AT_name));
408
409 // Now get the result.
410 MD5::MD5Result Result;
411 Hash.final(Result);
412
413 // ... take the least significant 8 bytes and return those. Our MD5
414 // implementation always returns its results in little endian, swap bytes
415 // appropriately.
416 return *reinterpret_cast<support::ulittle64_t *>(Result + 8);
417}
Eric Christopher0710bfa2013-08-13 01:21:55 +0000418
419/// This is based on the type signature computation given in section 7.27 of the
420/// DWARF4 standard. It is an md5 hash of the flattened description of the DIE
421/// with the inclusion of the full CU and all top level CU entities.
Eric Christopher800a8762013-09-03 21:57:57 +0000422// TODO: Initialize the type chain at 0 instead of 1 for CU signatures.
Eric Christopher0710bfa2013-08-13 01:21:55 +0000423uint64_t DIEHash::computeCUSignature(DIE *Die) {
David Blaikie3baa3c32013-10-21 18:59:40 +0000424 Numbering.clear();
425 Numbering[Die] = 1;
Eric Christopher0710bfa2013-08-13 01:21:55 +0000426
427 // Hash the DIE.
428 computeHash(Die);
429
430 // Now return the result.
431 MD5::MD5Result Result;
432 Hash.final(Result);
433
434 // ... take the least significant 8 bytes and return those. Our MD5
435 // implementation always returns its results in little endian, swap bytes
436 // appropriately.
437 return *reinterpret_cast<support::ulittle64_t *>(Result + 8);
438}
Eric Christopher800a8762013-09-03 21:57:57 +0000439
440/// This is based on the type signature computation given in section 7.27 of the
441/// DWARF4 standard. It is an md5 hash of the flattened description of the DIE
442/// with the inclusion of additional forms not specifically called out in the
443/// standard.
444uint64_t DIEHash::computeTypeSignature(DIE *Die) {
David Blaikie3baa3c32013-10-21 18:59:40 +0000445 Numbering.clear();
446 Numbering[Die] = 1;
Eric Christopher800a8762013-09-03 21:57:57 +0000447
David Blaikie88a68cb2013-10-17 00:10:34 +0000448 if (DIE *Parent = Die->getParent())
449 addParentContext(Parent);
450
Eric Christopher800a8762013-09-03 21:57:57 +0000451 // Hash the DIE.
452 computeHash(Die);
453
454 // Now return the result.
455 MD5::MD5Result Result;
456 Hash.final(Result);
457
458 // ... take the least significant 8 bytes and return those. Our MD5
459 // implementation always returns its results in little endian, swap bytes
460 // appropriately.
461 return *reinterpret_cast<support::ulittle64_t *>(Result + 8);
462}