summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/COFFDumper.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-09-11 22:00:50 +0000
committerReid Kleckner <rnk@google.com>2018-09-11 22:00:50 +0000
commita6f64265ea1a3651528370d4331f810686fbb39c (patch)
treef722b37d2d18baad0e887a7931c8ca5d57163aca /llvm/tools/llvm-readobj/COFFDumper.cpp
parent72b27a6a397404f7c1faff7813e26fd1f84b6183 (diff)
downloadbcm5719-llvm-a6f64265ea1a3651528370d4331f810686fbb39c.tar.gz
bcm5719-llvm-a6f64265ea1a3651528370d4331f810686fbb39c.zip
[codeview] Decode and dump FP regs from S_FRAMEPROC records
Summary: There are two registers encoded in the S_FRAMEPROC flags: one for locals and one for parameters. The encoding is described by the ExpandEncodedBasePointerReg function in cvinfo.h. Two bits are used to indicate one of four possible values: 0: no register - Used when there are no variables. 1: SP / standard - Variables are stored relative to the standard SP for the ISA. 2: FP - Variables are addressed relative to the ISA frame pointer, i.e. EBP on x86. If realignment is required, parameters use this. If a dynamic alloca is used, locals will be EBP relative. 3: Alternative - Variables are stored relative to some alternative third callee-saved register. This is required to address highly aligned locals when there are dynamic stack adjustments. In this case, both the incoming SP saved in the standard FP and the current SP are at some dynamic offset from the locals. LLVM uses ESI in this case, MSVC uses EBX. Most of the changes in this patch are to pass around the CPU so that we can decode these into real, named architectural registers. Subscribers: hiraditya Differential Revision: https://reviews.llvm.org/D51894 llvm-svn: 341999
Diffstat (limited to 'llvm/tools/llvm-readobj/COFFDumper.cpp')
-rw-r--r--llvm/tools/llvm-readobj/COFFDumper.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp
index e9944908982..8da5fc4234e 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/tools/llvm-readobj/COFFDumper.cpp
@@ -179,6 +179,10 @@ private:
DebugStringTableSubsectionRef CVStringTable;
+ /// Track the compilation CPU type. S_COMPILE3 symbol records typically come
+ /// first, but if we don't see one, just assume an X64 CPU type. It is common.
+ CPUType CompilationCPUType = CPUType::X64;
+
ScopedPrinter &Writer;
BinaryByteStream TypeContents;
LazyRandomTypeCollection Types;
@@ -1150,7 +1154,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
auto CODD = llvm::make_unique<COFFObjectDumpDelegate>(*this, Section, Obj,
SectionContents);
CVSymbolDumper CVSD(W, Types, CodeViewContainer::ObjectFile, std::move(CODD),
- opts::CodeViewSubsectionBytes);
+ CompilationCPUType, opts::CodeViewSubsectionBytes);
CVSymbolArray Symbols;
BinaryStreamReader Reader(BinaryData, llvm::support::little);
if (auto EC = Reader.readArray(Symbols, Reader.getLength())) {
@@ -1163,6 +1167,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
W.flush();
error(std::move(EC));
}
+ CompilationCPUType = CVSD.getCompilationCPUType();
W.flush();
}
OpenPOWER on IntegriCloud