[PATCH] D86272: [DebugInfo] Fix DwarfExpression::addConstantFP for float on big-endian
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 02:49:17 PDT 2020
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb43235a76c23: [DebugInfo] Fix DwarfExpression::addConstantFP for float on big-endian (authored by bjope).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86272/new/
https://reviews.llvm.org/D86272
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
Index: llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -231,14 +231,16 @@
emitOp(dwarf::DW_OP_implicit_value);
emitUnsigned(NumBytes /*Size of the block in bytes*/);
- const uint64_t *Value = API.getRawData();
- const bool IsLittleEndian = AP.getDataLayout().isLittleEndian();
- uint64_t Swapped = support::endian::byte_swap(
- *Value, IsLittleEndian ? support::little : support::big);
-
- const char *SwappedBytes = reinterpret_cast<const char *>(&Swapped);
- for (int i = 0; i < NumBytes; ++i)
- emitData1(SwappedBytes[i]);
+ // The loop below is emitting the value starting at least significant byte,
+ // so we need to perform a byte-swap to get the byte order correct in case
+ // of a big-endian target.
+ if (AP.getDataLayout().isBigEndian())
+ API = API.byteSwap();
+
+ for (int i = 0; i < NumBytes; ++i) {
+ emitData1(API.getZExtValue() & 0xFF);
+ API = API.lshr(8);
+ }
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86272.286757.patch
Type: text/x-patch
Size: 1147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200820/693e8b88/attachment.bin>
More information about the llvm-commits
mailing list