[llvm] r270106 - Modify emitTypeInformation to use MemoryTypeTableBuilder
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sun May 22 18:46:18 PDT 2016
Reverted in r270389, the following test case has it's behavior regressed:
https://ghostbin.com/paste/tpqbd
The difference comes down to a function type which we don't emit with
r270106:
FuncId (0x1003) {
TypeLeafKind: LF_FUNC_ID (0x1601)
ParentScope: 0x0
FunctionType: void () (0x1001)
Name: opover2.A8.opIndexUnary!("-", int).opIndexUnary
}
On Thu, May 19, 2016 at 1:12 PM, Adrian McCarthy via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: amccarth
> Date: Thu May 19 15:12:56 2016
> New Revision: 270106
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270106&view=rev
> Log:
> Modify emitTypeInformation to use MemoryTypeTableBuilder
>
> A baby step toward translating DIType records to CodeView.
>
> This does not (yet) combine the record length with the record data. I'm
> going back and forth trying to determine if that's a good idea.
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=270106&r1=270105&r2=270106&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Thu May 19
> 15:12:56 2016
> @@ -261,55 +261,30 @@ void CodeViewDebug::emitTypeInformation(
> // This type info currently only holds function ids for use with inline
> call
> // frame info. All functions are assigned a simple 'void ()' type. Emit
> that
> // type here.
> - unsigned ArgListIndex = getNextTypeIndex();
> - OS.AddComment("Type record length");
> - OS.EmitIntValue(ArgListRecord::getLayoutSize(), 2);
> - OS.AddComment("Leaf type: LF_ARGLIST");
> - OS.EmitIntValue(LF_ARGLIST, 2);
> - OS.AddComment("Number of arguments");
> - OS.EmitIntValue(0, 4);
> + ArrayRef<TypeIndex> NoArgs;
> + ArgListRecord ArgListRec(TypeRecordKind::ArgList, NoArgs);
> + TypeIndex ArgListIndex = TypeTable.writeArgList(ArgListRec);
>
> - unsigned VoidFnTyIdx = getNextTypeIndex();
> - OS.AddComment("Type record length");
> - OS.EmitIntValue(ProcedureRecord::getLayoutSize(), 2);
> - OS.AddComment("Leaf type: LF_PROCEDURE");
> - OS.EmitIntValue(LF_PROCEDURE, 2);
> - OS.AddComment("Return type index");
> - OS.EmitIntValue(TypeIndex::Void().getIndex(), 4);
> - OS.AddComment("Calling convention");
> - OS.EmitIntValue(char(CallingConvention::NearC), 1);
> - OS.AddComment("Function options");
> - OS.EmitIntValue(char(FunctionOptions::None), 1);
> - OS.AddComment("# of parameters");
> - OS.EmitIntValue(0, 2);
> - OS.AddComment("Argument list type index");
> - OS.EmitIntValue(ArgListIndex, 4);
> + ProcedureRecord Procedure(TypeIndex::Void(), CallingConvention::NearC,
> + FunctionOptions::None, 0, ArgListIndex);
> + TypeIndex VoidFnTyIdx = TypeTable.writeProcedure(Procedure);
>
> // Emit LF_FUNC_ID records for all inlined subprograms to the type
> stream.
> // Allocate one type index for each func id.
> - unsigned NextIdx = getNextTypeIndex(InlinedSubprograms.size());
> - (void)NextIdx;
> - assert(NextIdx == FuncIdTypeIndexStart && "func id type indices
> broken");
> for (auto *SP : InlinedSubprograms) {
> + TypeIndex ParentScope = TypeIndex(0);
> StringRef DisplayName = SP->getDisplayName();
> - OS.AddComment("Type record length");
> - MCSymbol *FuncBegin = MMI->getContext().createTempSymbol(),
> - *FuncEnd = MMI->getContext().createTempSymbol();
> - OS.emitAbsoluteSymbolDiff(FuncEnd, FuncBegin, 2);
> - OS.EmitLabel(FuncBegin);
> - OS.AddComment("Leaf type: LF_FUNC_ID");
> - OS.EmitIntValue(LF_FUNC_ID, 2);
> -
> - OS.AddComment("Scope type index");
> - OS.EmitIntValue(0, 4);
> - OS.AddComment("Function type");
> - OS.EmitIntValue(VoidFnTyIdx, 4);
> - {
> - OS.AddComment("Function name");
> - emitNullTerminatedSymbolName(OS, DisplayName);
> - }
> - OS.EmitLabel(FuncEnd);
> + FuncIdRecord FuncId(ParentScope, VoidFnTyIdx, DisplayName);
> + TypeTable.writeFuncId(FuncId);
> }
> +
> + TypeTable.ForEachRecord(
> + [&](TypeIndex Index, const MemoryTypeTableBuilder::Record *R) {
> + OS.AddComment("Type record length");
> + OS.EmitIntValue(R->size(), 2);
> + OS.AddComment("Type record data");
> + OS.EmitBytes(StringRef(R->data(), R->size()));
> + });
> }
>
> void CodeViewDebug::emitInlineeFuncIdsAndLines() {
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h?rev=270106&r1=270105&r2=270106&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.h Thu May 19 15:12:56
> 2016
> @@ -20,6 +20,7 @@
> #include "llvm/CodeGen/AsmPrinter.h"
> #include "llvm/CodeGen/MachineFunction.h"
> #include "llvm/CodeGen/MachineModuleInfo.h"
> +#include "llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h"
> #include "llvm/DebugInfo/CodeView/TypeIndex.h"
> #include "llvm/IR/DebugInfo.h"
> #include "llvm/IR/DebugLoc.h"
> @@ -34,6 +35,7 @@ class LexicalScope;
> /// \brief Collects and handles line tables information in a CodeView
> format.
> class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
> MCStreamer &OS;
> + codeview::MemoryTypeTableBuilder TypeTable;
>
> /// Represents the most general definition range.
> struct LocalVarDefRange {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160522/952fa9f1/attachment.html>
More information about the llvm-commits
mailing list