[PATCH] D77562: [NFC][XCOFF] refactor readobj/XCOFFDumper.cpp
Digger via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 08:40:07 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3aa084947e5f: [NFC][XCOFF] refactor readobj/XCOFFDumper.cpp (authored by DiggerLin).
Changed prior to commit:
https://reviews.llvm.org/D77562?vs=255439&id=255689#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77562/new/
https://reviews.llvm.org/D77562
Files:
llvm/include/llvm/Object/XCOFFObjectFile.h
llvm/tools/llvm-readobj/XCOFFDumper.cpp
Index: llvm/tools/llvm-readobj/XCOFFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/XCOFFDumper.cpp
+++ llvm/tools/llvm-readobj/XCOFFDumper.cpp
@@ -22,11 +22,6 @@
namespace {
class XCOFFDumper : public ObjDumper {
- enum {
- SymbolTypeMask = 0x07,
- SymbolAlignmentMask = 0xF8,
- SymbolAlignmentBitOffset = 3
- };
public:
XCOFFDumper(const XCOFFObjectFile &Obj, ScopedPrinter &Writer)
@@ -211,17 +206,15 @@
DictScope SymDs(W, "CSECT Auxiliary Entry");
W.printNumber("Index",
Obj.getSymbolIndex(reinterpret_cast<uintptr_t>(AuxEntPtr)));
- if ((AuxEntPtr->SymbolAlignmentAndType & SymbolTypeMask) == XCOFF::XTY_LD)
+ if (AuxEntPtr->isLabel())
W.printNumber("ContainingCsectSymbolIndex", AuxEntPtr->SectionOrLength);
else
W.printNumber("SectionLen", AuxEntPtr->SectionOrLength);
W.printHex("ParameterHashIndex", AuxEntPtr->ParameterHashIndex);
W.printHex("TypeChkSectNum", AuxEntPtr->TypeChkSectNum);
// Print out symbol alignment and type.
- W.printNumber("SymbolAlignmentLog2",
- (AuxEntPtr->SymbolAlignmentAndType & SymbolAlignmentMask) >>
- SymbolAlignmentBitOffset);
- W.printEnum("SymbolType", AuxEntPtr->SymbolAlignmentAndType & SymbolTypeMask,
+ W.printNumber("SymbolAlignmentLog2", AuxEntPtr->getAlignmentLog2());
+ W.printEnum("SymbolType", AuxEntPtr->getSymbolType(),
makeArrayRef(CsectSymbolTypeClass));
W.printEnum("StorageMappingClass",
static_cast<uint8_t>(AuxEntPtr->StorageMappingClass),
Index: llvm/include/llvm/Object/XCOFFObjectFile.h
===================================================================
--- llvm/include/llvm/Object/XCOFFObjectFile.h
+++ llvm/include/llvm/Object/XCOFFObjectFile.h
@@ -130,6 +130,8 @@
struct XCOFFCsectAuxEnt32 {
static constexpr uint8_t SymbolTypeMask = 0x07;
+ static constexpr uint8_t SymbolAlignmentMask = 0xF8;
+ static constexpr size_t SymbolAlignmentBitOffset = 3;
support::ubig32_t
SectionOrLength; // If the symbol type is XTY_SD or XTY_CM, the csect
@@ -144,9 +146,14 @@
support::ubig32_t StabInfoIndex;
support::ubig16_t StabSectNum;
+ uint16_t getAlignmentLog2() const {
+ return (SymbolAlignmentAndType & SymbolAlignmentMask) >>
+ SymbolAlignmentBitOffset;
+ }
+
uint8_t getSymbolType() const {
return SymbolAlignmentAndType & SymbolTypeMask;
- };
+ }
bool isLabel() const { return getSymbolType() == XCOFF::XTY_LD; }
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77562.255689.patch
Type: text/x-patch
Size: 2540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200407/8168617b/attachment.bin>
More information about the llvm-commits
mailing list