<div dir="ltr">For future reference, there's a handy script in LLVM (utils/git-svn/git-svnrevert) to make a revert using a subversion revision number instead of a git hash - makes it easier for folks reading the mailing list to understand what patch was reverted.<br><br>Also, please include a description of why a patch was reverted in the commit message - again, makes it a bit easier to follow along at home :)</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 8:57 AM Yonghong Song via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: yhs<br>
Date: Fri Nov 30 08:54:43 2018<br>
New Revision: 348004<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=348004&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=348004&view=rev</a><br>
Log:<br>
Revert "[BTF] Add BTF DebugInfo"<br>
<br>
This reverts commit 9c6b970db8bc63b28ce58a129bb1580a6a3c6caf.<br>
<br>
Removed:<br>
llvm/trunk/include/llvm/BinaryFormat/BTF.def<br>
llvm/trunk/include/llvm/BinaryFormat/BTF.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebugStub.cpp<br>
llvm/trunk/test/DebugInfo/BTF/<br>
Modified:<br>
llvm/trunk/include/llvm/MC/MCObjectFileInfo.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h<br>
llvm/trunk/lib/MC/MCObjectFileInfo.cpp<br>
<br>
Removed: llvm/trunk/include/llvm/BinaryFormat/BTF.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/BTF.def?rev=348003&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/BTF.def?rev=348003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/BinaryFormat/BTF.def (original)<br>
+++ llvm/trunk/include/llvm/BinaryFormat/BTF.def (removed)<br>
@@ -1,33 +0,0 @@<br>
-//===- llvm/BinaryFormat/BTF.def - BTF definitions --------------*- C++ -*-===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// Macros for BTF.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#if !defined(HANDLE_BTF_KIND)<br>
-#error "Missing macro definition of HANDLE_BTF_*"<br>
-#endif<br>
-<br>
-HANDLE_BTF_KIND(0, UNKN)<br>
-HANDLE_BTF_KIND(1, INT)<br>
-HANDLE_BTF_KIND(2, PTR)<br>
-HANDLE_BTF_KIND(3, ARRAY)<br>
-HANDLE_BTF_KIND(4, STRUCT)<br>
-HANDLE_BTF_KIND(5, UNION)<br>
-HANDLE_BTF_KIND(6, ENUM)<br>
-HANDLE_BTF_KIND(7, FWD)<br>
-HANDLE_BTF_KIND(8, TYPEDEF)<br>
-HANDLE_BTF_KIND(9, VOLATILE)<br>
-HANDLE_BTF_KIND(10, CONST)<br>
-HANDLE_BTF_KIND(11, RESTRICT)<br>
-HANDLE_BTF_KIND(12, FUNC)<br>
-HANDLE_BTF_KIND(13, FUNC_PROTO)<br>
-<br>
-#undef HANDLE_BTF_KIND<br>
<br>
Removed: llvm/trunk/include/llvm/BinaryFormat/BTF.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/BTF.h?rev=348003&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/BTF.h?rev=348003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/BinaryFormat/BTF.h (original)<br>
+++ llvm/trunk/include/llvm/BinaryFormat/BTF.h (removed)<br>
@@ -1,203 +0,0 @@<br>
-//===-- llvm/BinaryFormat/BTF.h ---------------------------------*- C++ -*-===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-///<br>
-/// \file<br>
-/// This file contains the layout of .BTF and .BTF.ext ELF sections.<br>
-///<br>
-/// The binary layout for .BTF section:<br>
-/// struct Header<br>
-/// Type and Str subsections<br>
-/// The Type subsection is a collection of types with type id starting with 1.<br>
-/// The Str subsection is simply a collection of strings.<br>
-///<br>
-/// The binary layout for .BTF.ext section:<br>
-/// struct ExtHeader<br>
-/// FuncInfo and LineInfo subsections<br>
-/// The FuncInfo subsection is defined as below:<br>
-/// BTFFuncInfo Size<br>
-/// struct SecFuncInfo for ELF section #1<br>
-/// A number of struct BPFFuncInfo for ELF section #1<br>
-/// struct SecFuncInfo for ELF section #2<br>
-/// A number of struct BPFFuncInfo for ELF section #2<br>
-/// ...<br>
-/// The LineInfo subsection is defined as below:<br>
-/// BPFLineInfo Size<br>
-/// struct SecLineInfo for ELF section #1<br>
-/// A number of struct BPFLineInfo for ELF section #1<br>
-/// struct SecLineInfo for ELF section #2<br>
-/// A number of struct BPFLineInfo for ELF section #2<br>
-/// ...<br>
-///<br>
-/// The section formats are also defined at<br>
-/// <a href="https://github.com/torvalds/linux/blob/master/include/uapi/linux/btf.h" rel="noreferrer" target="_blank">https://github.com/torvalds/linux/blob/master/include/uapi/linux/btf.h</a><br>
-///<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef LLVM_BINARYFORMAT_BTF_H<br>
-#define LLVM_BINARYFORMAT_BTF_H<br>
-<br>
-namespace llvm {<br>
-namespace BTF {<br>
-<br>
-enum : uint32_t { MAGIC = 0xeB9F, VERSION = 1 };<br>
-<br>
-/// Sizes in bytes of various things in the BTF format.<br>
-enum {<br>
- HeaderSize = 24,<br>
- ExtHeaderSize = 24,<br>
- CommonTypeSize = 12,<br>
- BTFArraySize = 12,<br>
- BTFEnumSize = 8,<br>
- BTFMemberSize = 12,<br>
- BTFParamSize = 8,<br>
- SecFuncInfoSize = 8,<br>
- SecLineInfoSize = 8,<br>
- BPFFuncInfoSize = 8,<br>
- BPFLineInfoSize = 16<br>
-};<br>
-<br>
-/// The .BTF section header definition.<br>
-struct Header {<br>
- uint16_t Magic; ///< Magic value<br>
- uint8_t Version; ///< Version number<br>
- uint8_t Flags; ///< Extra flags<br>
- uint32_t HdrLen; ///< Length of this header<br>
-<br>
- /// All offsets are in bytes relative to the end of this header.<br>
- uint32_t TypeOff; ///< Offset of type section<br>
- uint32_t TypeLen; ///< Length of type section<br>
- uint32_t StrOff; ///< Offset of string section<br>
- uint32_t StrLen; ///< Length of string section<br>
-};<br>
-<br>
-enum : uint32_t {<br>
- MAX_TYPE = 0xffff, ///< Max # of type identifier<br>
- MAX_NAME_OFFSET = 0xffff, ///< Max offset into the string section<br>
- MAX_VLEN = 0xffff ///< Max # of struct/union/enum members or func args<br>
-};<br>
-<br>
-enum TypeKinds : uint8_t {<br>
-#define HANDLE_BTF_KIND(ID, NAME) BTF_KIND_##NAME = ID,<br>
-#include "llvm/BinaryFormat/BTF.def"<br>
-};<br>
-<br>
-/// The BTF common type definition. Different kinds may have<br>
-/// additional information after this structure data.<br>
-struct CommonType {<br>
- /// Type name offset in the string table.<br>
- uint32_t NameOff;<br>
-<br>
- /// "Info" bits arrangement:<br>
- /// Bits 0-15: vlen (e.g. # of struct's members)<br>
- /// Bits 16-23: unused<br>
- /// Bits 24-27: kind (e.g. int, ptr, array...etc)<br>
- /// Bits 28-31: unused<br>
- uint32_t Info;<br>
-<br>
- /// "Size" is used by INT, ENUM, STRUCT and UNION.<br>
- /// "Size" tells the size of the type it is describing.<br>
- ///<br>
- /// "Type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT,<br>
- /// FUNC and FUNC_PROTO.<br>
- /// "Type" is a type_id referring to another type.<br>
- union {<br>
- uint32_t Size;<br>
- uint32_t Type;<br>
- };<br>
-};<br>
-<br>
-// For some specific BTF_KIND, "struct CommonType" is immediately<br>
-// followed by extra data.<br>
-<br>
-// BTF_KIND_INT is followed by a u32 and the following<br>
-// is the 32 bits arrangement:<br>
-// BTF_INT_ENCODING(VAL) : (((VAL) & 0x0f000000) >> 24)<br>
-// BTF_INT_OFFSET(VAL) : (((VAL & 0x00ff0000)) >> 16)<br>
-// BTF_INT_BITS(VAL) : ((VAL) & 0x000000ff)<br>
-<br>
-/// Attributes stored in the INT_ENCODING.<br>
-enum : uint8_t { INT_SIGNED = (1 << 0), INT_CHAR = (1 << 1), INT_BOOL = (1 << 2) };<br>
-<br>
-/// BTF_KIND_ENUM is followed by multiple "struct BTFEnum".<br>
-/// The exact number of btf_enum is stored in the vlen (of the<br>
-/// info in "struct CommonType").<br>
-struct BTFEnum {<br>
- uint32_t NameOff; ///< Enum name offset in the string table<br>
- int32_t Val; ///< Enum member value<br>
-};<br>
-<br>
-/// BTF_KIND_ARRAY is followed by one "struct BTFArray".<br>
-struct BTFArray {<br>
- uint32_t ElemType; ///< Element type<br>
- uint32_t IndexType; ///< Index type<br>
- uint32_t Nelems; ///< Number of elements for this array<br>
-};<br>
-<br>
-/// BTF_KIND_STRUCT and BTF_KIND_UNION are followed<br>
-/// by multiple "struct BTFMember". The exact number<br>
-/// of BTFMember is stored in the vlen (of the info in<br>
-/// "struct CommonType").<br>
-struct BTFMember {<br>
- uint32_t NameOff; ///< Member name offset in the string table<br>
- uint32_t Type; ///< Member type<br>
- uint32_t Offset; ///< Offset in bits from the struct start<br>
-};<br>
-<br>
-/// BTF_KIND_FUNC_PROTO are followed by multiple "struct BTFParam".<br>
-/// The exist number of BTFParam is stored in the vlen (of the info<br>
-/// in "struct CommonType").<br>
-struct BTFParam {<br>
- uint32_t NameOff;<br>
- uint32_t Type;<br>
-};<br>
-<br>
-/// The .BTF.ext section header definition.<br>
-struct ExtHeader {<br>
- uint16_t Magic;<br>
- uint8_t Version;<br>
- uint8_t Flags;<br>
- uint32_t HdrLen;<br>
-<br>
- uint32_t FuncInfoOff; ///< Offset of func info section<br>
- uint32_t FuncInfoLen; ///< Length of func info section<br>
- uint32_t LineInfoOff; ///< Offset of line info section<br>
- uint32_t LineInfoLen; ///< Length of line info section<br>
-};<br>
-<br>
-/// Specifying one function info.<br>
-struct BPFFuncInfo {<br>
- uint32_t InsnOffset; ///< Byte offset in the section<br>
- uint32_t TypeId; ///< Type id referring to .BTF type section<br>
-};<br>
-<br>
-/// Specifying function info's in one section.<br>
-struct SecFuncInfo {<br>
- uint32_t SecNameOff; ///< Section name index in the .BTF string table<br>
- uint32_t NumFuncInfo; ///< Number of func info's in this section<br>
-};<br>
-<br>
-/// Specifying one line info.<br>
-struct BPFLineInfo {<br>
- uint32_t InsnOffset; ///< Byte offset in this section<br>
- uint32_t FileNameOff; ///< File name index in the .BTF string table<br>
- uint32_t LineOff; ///< Line index in the .BTF string table<br>
- uint32_t LineCol; ///< Line num: line_col >> 10,<br>
- /// col num: line_col & 0x3ff<br>
-};<br>
-<br>
-/// Specifying line info's in one section.<br>
-struct SecLineInfo {<br>
- uint32_t SecNameOff; ///< Section name index in the .BTF string tble<br>
- uint32_t NumLineInfo; ///< Number of line info's in this section<br>
-};<br>
-<br>
-} // End namespace BTF.<br>
-} // End namespace llvm.<br>
-<br>
-#endif<br>
<br>
Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=348004&r1=348003&r2=348004&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=348004&r1=348003&r2=348004&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)<br>
+++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Fri Nov 30 08:54:43 2018<br>
@@ -209,14 +209,6 @@ protected:<br>
MCSection *SXDataSection;<br>
MCSection *GFIDsSection;<br>
<br>
- /// BTF-specific sections. BTF stands for BPF Type Format which is<br>
- /// designed for BPF target and consumed by BPF loader and<br>
- /// the kernel.<br>
- /// @{<br>
- MCSection *BTFSection;<br>
- MCSection *BTFExtSection;<br>
- /// @}<br>
-<br>
public:<br>
void InitMCObjectFileInfo(const Triple &TT, bool PIC, MCContext &ctx,<br>
bool LargeCodeModel = false);<br>
@@ -388,12 +380,6 @@ public:<br>
return EHFrameSection;<br>
}<br>
<br>
- // BTF specific sections.<br>
- /// @{<br>
- MCSection *getBTFSection() const { return BTFSection; }<br>
- MCSection *getBTFExtSection() const { return BTFExtSection; }<br>
- /// @}<br>
-<br>
enum Environment { IsMachO, IsELF, IsCOFF, IsWasm };<br>
Environment getObjectFileType() const { return Env; }<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=348004&r1=348003&r2=348004&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=348004&r1=348003&r2=348004&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Nov 30 08:54:43 2018<br>
@@ -13,7 +13,6 @@<br>
<br>
#include "llvm/CodeGen/AsmPrinter.h"<br>
#include "AsmPrinterHandler.h"<br>
-#include "BTFDebug.h"<br>
#include "CodeViewDebug.h"<br>
#include "DwarfDebug.h"<br>
#include "DwarfException.h"<br>
@@ -141,8 +140,6 @@ static const char *const CFGuardDescript<br>
static const char *const CodeViewLineTablesGroupName = "linetables";<br>
static const char *const CodeViewLineTablesGroupDescription =<br>
"CodeView Line Tables";<br>
-static const char *const BTFGroupName = "BTF";<br>
-static const char *const BTFGroupDescription = "BTF Emission";<br>
<br>
STATISTIC(EmittedInsts, "Number of machine instrs printed");<br>
<br>
@@ -314,12 +311,6 @@ bool AsmPrinter::doInitialization(Module<br>
Handlers.push_back(HandlerInfo(DD, DbgTimerName, DbgTimerDescription,<br>
DWARFGroupName, DWARFGroupDescription));<br>
}<br>
- const Triple &TT = TM.getTargetTriple();<br>
- if (TT.getArch() == Triple::bpfel || TT.getArch() == Triple::bpfeb) {<br>
- Handlers.push_back(HandlerInfo(new BTFDebug(this),<br>
- DbgTimerName, DbgTimerDescription,<br>
- BTFGroupName, BTFGroupDescription));<br>
- }<br>
}<br>
<br>
switch (MAI->getExceptionHandlingType()) {<br>
<br>
Removed: llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.cpp?rev=348003&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.cpp?rev=348003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.cpp (removed)<br>
@@ -1,770 +0,0 @@<br>
-//===- llvm/lib/CodeGen/AsmPrinter/BTFDebug.cpp ---------------------------===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// This file contains support for writing BTF debug info.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include "BTFDebug.h"<br>
-#include "llvm/CodeGen/AsmPrinter.h"<br>
-#include "llvm/CodeGen/MachineModuleInfo.h"<br>
-#include "llvm/MC/MCContext.h"<br>
-#include "llvm/MC/MCObjectFileInfo.h"<br>
-#include "llvm/MC/MCSectionELF.h"<br>
-#include "llvm/MC/MCStreamer.h"<br>
-#include <fstream><br>
-#include <sstream><br>
-<br>
-using namespace llvm;<br>
-<br>
-static const char *BTFKindStr[] = {<br>
-#define HANDLE_BTF_KIND(ID, NAME) "BTF_KIND_" #NAME,<br>
-#include "llvm/BinaryFormat/BTF.def"<br>
-};<br>
-<br>
-/// Emit a BTF common type.<br>
-void BTFTypeBase::emitType(MCStreamer &OS) {<br>
- OS.AddComment(std::string(BTFKindStr[Kind]) + "(id = " + std::to_string(Id) +<br>
- ")");<br>
- OS.EmitIntValue(BTFType.NameOff, 4);<br>
- OS.AddComment("0x" + Twine::utohexstr(BTFType.Info));<br>
- OS.EmitIntValue(BTFType.Info, 4);<br>
- OS.EmitIntValue(BTFType.Size, 4);<br>
-}<br>
-<br>
-BTFTypeDerived::BTFTypeDerived(const DIDerivedType *DTy, unsigned Tag)<br>
- : DTy(DTy) {<br>
- switch (Tag) {<br>
- case dwarf::DW_TAG_pointer_type:<br>
- Kind = BTF::BTF_KIND_PTR;<br>
- break;<br>
- case dwarf::DW_TAG_const_type:<br>
- Kind = BTF::BTF_KIND_CONST;<br>
- break;<br>
- case dwarf::DW_TAG_volatile_type:<br>
- Kind = BTF::BTF_KIND_VOLATILE;<br>
- break;<br>
- case dwarf::DW_TAG_typedef:<br>
- Kind = BTF::BTF_KIND_TYPEDEF;<br>
- break;<br>
- case dwarf::DW_TAG_restrict_type:<br>
- Kind = BTF::BTF_KIND_RESTRICT;<br>
- break;<br>
- default:<br>
- llvm_unreachable("Unknown DIDerivedType Tag");<br>
- }<br>
- BTFType.Info = Kind << 24;<br>
-}<br>
-<br>
-void BTFTypeDerived::completeType(BTFDebug &BDebug) {<br>
- BTFType.NameOff = BDebug.addString(DTy->getName());<br>
-<br>
- // The base type for PTR/CONST/VOLATILE could be void.<br>
- const DIType *ResolvedType = DTy->getBaseType().resolve();<br>
- if (!ResolvedType) {<br>
- assert((Kind == BTF::BTF_KIND_PTR || Kind == BTF::BTF_KIND_CONST ||<br>
- Kind == BTF::BTF_KIND_VOLATILE) &&<br>
- "Invalid null basetype");<br>
- BTFType.Type = 0;<br>
- } else {<br>
- BTFType.Type = BDebug.getTypeId(ResolvedType);<br>
- }<br>
-}<br>
-<br>
-void BTFTypeDerived::emitType(MCStreamer &OS) { BTFTypeBase::emitType(OS); }<br>
-<br>
-/// Represent a struct/union forward declaration.<br>
-BTFTypeFwd::BTFTypeFwd(StringRef Name) : Name(Name) {<br>
- Kind = BTF::BTF_KIND_FWD;<br>
- BTFType.Info = Kind << 24;<br>
- BTFType.Type = 0;<br>
-}<br>
-<br>
-void BTFTypeFwd::completeType(BTFDebug &BDebug) {<br>
- BTFType.NameOff = BDebug.addString(Name);<br>
-}<br>
-<br>
-void BTFTypeFwd::emitType(MCStreamer &OS) { BTFTypeBase::emitType(OS); }<br>
-<br>
-BTFTypeInt::BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits,<br>
- uint32_t OffsetInBits, StringRef TypeName)<br>
- : Name(TypeName) {<br>
- // Translate IR int encoding to BTF int encoding.<br>
- uint8_t BTFEncoding;<br>
- switch (Encoding) {<br>
- case dwarf::DW_ATE_boolean:<br>
- BTFEncoding = BTF::INT_BOOL;<br>
- break;<br>
- case dwarf::DW_ATE_signed:<br>
- case dwarf::DW_ATE_signed_char:<br>
- BTFEncoding = BTF::INT_SIGNED;<br>
- break;<br>
- case dwarf::DW_ATE_unsigned:<br>
- case dwarf::DW_ATE_unsigned_char:<br>
- BTFEncoding = 0;<br>
- break;<br>
- default:<br>
- llvm_unreachable("Unknown BTFTypeInt Encoding");<br>
- }<br>
-<br>
- Kind = BTF::BTF_KIND_INT;<br>
- BTFType.Info = Kind << 24;<br>
- BTFType.Size = roundupToBytes(SizeInBits);<br>
- IntVal = (BTFEncoding << 24) | OffsetInBits << 16 | SizeInBits;<br>
-}<br>
-<br>
-void BTFTypeInt::completeType(BTFDebug &BDebug) {<br>
- BTFType.NameOff = BDebug.addString(Name);<br>
-}<br>
-<br>
-void BTFTypeInt::emitType(MCStreamer &OS) {<br>
- BTFTypeBase::emitType(OS);<br>
- OS.AddComment("0x" + Twine::utohexstr(IntVal));<br>
- OS.EmitIntValue(IntVal, 4);<br>
-}<br>
-<br>
-BTFTypeEnum::BTFTypeEnum(const DICompositeType *ETy, uint32_t VLen) : ETy(ETy) {<br>
- Kind = BTF::BTF_KIND_ENUM;<br>
- BTFType.Info = Kind << 24 | VLen;<br>
- BTFType.Size = roundupToBytes(ETy->getSizeInBits());<br>
-}<br>
-<br>
-void BTFTypeEnum::completeType(BTFDebug &BDebug) {<br>
- BTFType.NameOff = BDebug.addString(ETy->getName());<br>
-<br>
- DINodeArray Elements = ETy->getElements();<br>
- for (const auto Element : Elements) {<br>
- const auto *Enum = cast<DIEnumerator>(Element);<br>
-<br>
- struct BTF::BTFEnum BTFEnum;<br>
- BTFEnum.NameOff = BDebug.addString(Enum->getName());<br>
- // BTF enum value is 32bit, enforce it.<br>
- BTFEnum.Val = static_cast<uint32_t>(Enum->getValue());<br>
- EnumValues.push_back(BTFEnum);<br>
- }<br>
-}<br>
-<br>
-void BTFTypeEnum::emitType(MCStreamer &OS) {<br>
- BTFTypeBase::emitType(OS);<br>
- for (const auto &Enum : EnumValues) {<br>
- OS.EmitIntValue(Enum.NameOff, 4);<br>
- OS.EmitIntValue(Enum.Val, 4);<br>
- }<br>
-}<br>
-<br>
-BTFTypeArray::BTFTypeArray(const DICompositeType *ATy) : ATy(ATy) {<br>
- Kind = BTF::BTF_KIND_ARRAY;<br>
- BTFType.Info = Kind << 24;<br>
-}<br>
-<br>
-/// Represent a BTF array. BTF does not record array dimensions,<br>
-/// so conceptually a BTF array is a one-dimensional array.<br>
-void BTFTypeArray::completeType(BTFDebug &BDebug) {<br>
- BTFType.NameOff = BDebug.addString(ATy->getName());<br>
- BTFType.Size = 0;<br>
-<br>
- auto *BaseType = ATy->getBaseType().resolve();<br>
- ArrayInfo.ElemType = BDebug.getTypeId(BaseType);<br>
-<br>
- // The IR does not really have a type for the index.<br>
- // A special type for array index should have been<br>
- // created during initial type traversal. Just<br>
- // retrieve that type id.<br>
- ArrayInfo.IndexType = BDebug.getArrayIndexTypeId();<br>
-<br>
- // Get the number of array elements.<br>
- // If the array size is 0, set the number of elements as 0.<br>
- // Otherwise, recursively traverse the base types to<br>
- // find the element size. The number of elements is<br>
- // the totoal array size in bits divided by<br>
- // element size in bits.<br>
- uint64_t ArraySizeInBits = ATy->getSizeInBits();<br>
- if (!ArraySizeInBits) {<br>
- ArrayInfo.Nelems = 0;<br>
- } else {<br>
- uint32_t BaseTypeSize = BaseType->getSizeInBits();<br>
- while (!BaseTypeSize) {<br>
- const auto *DDTy = cast<DIDerivedType>(BaseType);<br>
- BaseType = DDTy->getBaseType().resolve();<br>
- assert(BaseType);<br>
- BaseTypeSize = BaseType->getSizeInBits();<br>
- }<br>
- ArrayInfo.Nelems = ATy->getSizeInBits() / BaseTypeSize;<br>
- }<br>
-}<br>
-<br>
-void BTFTypeArray::emitType(MCStreamer &OS) {<br>
- BTFTypeBase::emitType(OS);<br>
- OS.EmitIntValue(ArrayInfo.ElemType, 4);<br>
- OS.EmitIntValue(ArrayInfo.IndexType, 4);<br>
- OS.EmitIntValue(ArrayInfo.Nelems, 4);<br>
-}<br>
-<br>
-/// Represent either a struct or a union.<br>
-BTFTypeStruct::BTFTypeStruct(const DICompositeType *STy, bool IsStruct,<br>
- uint32_t Vlen)<br>
- : STy(STy) {<br>
- Kind = IsStruct ? BTF::BTF_KIND_STRUCT : BTF::BTF_KIND_UNION;<br>
- BTFType.Size = roundupToBytes(STy->getSizeInBits());<br>
- BTFType.Info = (Kind << 24) | Vlen;<br>
-}<br>
-<br>
-void BTFTypeStruct::completeType(BTFDebug &BDebug) {<br>
- BTFType.NameOff = BDebug.addString(STy->getName());<br>
-<br>
- // Add struct/union members.<br>
- // If the member is a bitfield, get the corresponding int type<br>
- // specially created to represent the bitfield. Otherwise,<br>
- // the member type is the base type of this member.<br>
- //<br>
- // FIXME: The real bitfield base type is lost. There<br>
- // is discussion to define a different type kind for<br>
- // bitfield in order to preserve its base type.<br>
- // Revisit this if the new kind or new mechanism is available.<br>
- const DINodeArray Elements = STy->getElements();<br>
- for (const auto *Element : Elements) {<br>
- struct BTF::BTFMember BTFMember;<br>
- const auto *DDTy = cast<DIDerivedType>(Element);<br>
-<br>
- BTFMember.NameOff = BDebug.addString(DDTy->getName());<br>
- BTFMember.Offset = DDTy->getOffsetInBits();<br>
- if (DDTy->isBitField())<br>
- BTFMember.Type = BDebug.getBitFieldTypeId(DDTy);<br>
- else<br>
- BTFMember.Type = BDebug.getTypeId(DDTy->getBaseType().resolve());<br>
- Members.push_back(BTFMember);<br>
- }<br>
-}<br>
-<br>
-void BTFTypeStruct::emitType(MCStreamer &OS) {<br>
- BTFTypeBase::emitType(OS);<br>
- for (const auto &Member : Members) {<br>
- OS.EmitIntValue(Member.NameOff, 4);<br>
- OS.EmitIntValue(Member.Type, 4);<br>
- OS.EmitIntValue(Member.Offset, 4);<br>
- }<br>
-}<br>
-<br>
-/// The Func kind represents both subprogram and pointee of function<br>
-/// pointers. If the FuncName is empty, it represents a pointee of function<br>
-/// pointer. Otherwise, it represents a subprogram. The func arg names<br>
-/// are empty for pointee of function pointer case, and are valid names<br>
-/// for subprogram.<br>
-BTFTypeFuncProto::BTFTypeFuncProto(<br>
- const DISubroutineType *STy, uint32_t VLen,<br>
- const std::unordered_map<uint32_t, StringRef> &FuncArgNames)<br>
- : STy(STy), FuncArgNames(FuncArgNames) {<br>
- Kind = BTF::BTF_KIND_FUNC_PROTO;<br>
- BTFType.Info = (Kind << 24) | VLen;<br>
-}<br>
-<br>
-void BTFTypeFuncProto::completeType(BTFDebug &BDebug) {<br>
- DITypeRefArray Elements = STy->getTypeArray();<br>
- auto RetType = Elements[0].resolve();<br>
- BTFType.Type = RetType ? BDebug.getTypeId(RetType) : 0;<br>
- BTFType.NameOff = 0;<br>
-<br>
- // For null parameter which is typically the last one<br>
- // to represent the vararg, encode the NameOff/Type to be 0.<br>
- for (unsigned I = 1, N = Elements.size(); I < N; ++I) {<br>
- struct BTF::BTFParam Param;<br>
- auto Element = Elements[I].resolve();<br>
- if (Element) {<br>
- Param.NameOff = BDebug.addString(FuncArgNames[I]);<br>
- Param.Type = BDebug.getTypeId(Element);<br>
- } else {<br>
- Param.NameOff = 0;<br>
- Param.Type = 0;<br>
- }<br>
- Parameters.push_back(Param);<br>
- }<br>
-}<br>
-<br>
-void BTFTypeFuncProto::emitType(MCStreamer &OS) {<br>
- BTFTypeBase::emitType(OS);<br>
- for (const auto &Param : Parameters) {<br>
- OS.EmitIntValue(Param.NameOff, 4);<br>
- OS.EmitIntValue(Param.Type, 4);<br>
- }<br>
-}<br>
-<br>
-BTFTypeFunc::BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId)<br>
- : Name(FuncName) {<br>
- Kind = BTF::BTF_KIND_FUNC;<br>
- BTFType.Info = Kind << 24;<br>
- BTFType.Type = ProtoTypeId;<br>
-}<br>
-<br>
-void BTFTypeFunc::completeType(BTFDebug &BDebug) {<br>
- BTFType.NameOff = BDebug.addString(Name);<br>
-}<br>
-<br>
-void BTFTypeFunc::emitType(MCStreamer &OS) { BTFTypeBase::emitType(OS); }<br>
-<br>
-uint32_t BTFStringTable::addString(StringRef S) {<br>
- // Check whether the string already exists.<br>
- for (auto &OffsetM : OffsetToIdMap) {<br>
- if (Table[OffsetM.second] == S)<br>
- return OffsetM.first;<br>
- }<br>
- // Not find, add to the string table.<br>
- uint32_t Offset = Size;<br>
- OffsetToIdMap[Offset] = Table.size();<br>
- Table.push_back(S);<br>
- Size += S.size() + 1;<br>
- return Offset;<br>
-}<br>
-<br>
-BTFDebug::BTFDebug(AsmPrinter *AP)<br>
- : DebugHandlerBase(AP), OS(*Asm->OutStreamer), SkipInstruction(false),<br>
- LineInfoGenerated(false), SecNameOff(0), ArrayIndexTypeId(0) {<br>
- addString("\0");<br>
-}<br>
-<br>
-void BTFDebug::addType(std::unique_ptr<BTFTypeBase> TypeEntry,<br>
- const DIType *Ty) {<br>
- TypeEntry->setId(TypeEntries.size() + 1);<br>
- DIToIdMap[Ty] = TypeEntry->getId();<br>
- TypeEntries.push_back(std::move(TypeEntry));<br>
-}<br>
-<br>
-uint32_t BTFDebug::addType(std::unique_ptr<BTFTypeBase> TypeEntry) {<br>
- TypeEntry->setId(TypeEntries.size() + 1);<br>
- uint32_t Id = TypeEntry->getId();<br>
- TypeEntries.push_back(std::move(TypeEntry));<br>
- return Id;<br>
-}<br>
-<br>
-void BTFDebug::visitBasicType(const DIBasicType *BTy) {<br>
- // Only int types are supported in BTF.<br>
- uint32_t Encoding = BTy->getEncoding();<br>
- if (Encoding != dwarf::DW_ATE_boolean && Encoding != dwarf::DW_ATE_signed &&<br>
- Encoding != dwarf::DW_ATE_signed_char &&<br>
- Encoding != dwarf::DW_ATE_unsigned &&<br>
- Encoding != dwarf::DW_ATE_unsigned_char)<br>
- return;<br>
-<br>
- // Create a BTF type instance for this DIBasicType and put it into<br>
- // DIToIdMap for cross-type reference check.<br>
- auto TypeEntry = llvm::make_unique<BTFTypeInt>(<br>
- Encoding, BTy->getSizeInBits(), BTy->getOffsetInBits(), BTy->getName());<br>
- addType(std::move(TypeEntry), BTy);<br>
-}<br>
-<br>
-/// Handle subprogram or subroutine types.<br>
-void BTFDebug::visitSubroutineType(<br>
- const DISubroutineType *STy, bool ForSubprog,<br>
- const std::unordered_map<uint32_t, StringRef> &FuncArgNames,<br>
- uint32_t &TypeId) {<br>
- DITypeRefArray Elements = STy->getTypeArray();<br>
- uint32_t VLen = Elements.size() - 1;<br>
- if (VLen > BTF::MAX_VLEN)<br>
- return;<br>
-<br>
- // Subprogram has a valid non-zero-length name, and the pointee of<br>
- // a function pointer has an empty name. The subprogram type will<br>
- // not be added to DIToIdMap as it should not be referenced by<br>
- // any other types.<br>
- auto TypeEntry = llvm::make_unique<BTFTypeFuncProto>(STy, VLen, FuncArgNames);<br>
- if (ForSubprog)<br>
- TypeId = addType(std::move(TypeEntry)); // For subprogram<br>
- else<br>
- addType(std::move(TypeEntry), STy); // For func ptr<br>
-<br>
- // Visit return type and func arg types.<br>
- for (const auto Element : Elements) {<br>
- visitTypeEntry(Element.resolve());<br>
- }<br>
-}<br>
-<br>
-/// Handle structure/union types.<br>
-void BTFDebug::visitStructType(const DICompositeType *CTy, bool IsStruct) {<br>
- const DINodeArray Elements = CTy->getElements();<br>
- uint32_t VLen = Elements.size();<br>
- if (VLen > BTF::MAX_VLEN)<br>
- return;<br>
-<br>
- auto TypeEntry = llvm::make_unique<BTFTypeStruct>(CTy, IsStruct, VLen);<br>
- addType(std::move(TypeEntry), CTy);<br>
-<br>
- // Visit all struct members.<br>
- for (const auto *Element : Elements)<br>
- visitTypeEntry(cast<DIDerivedType>(Element));<br>
-}<br>
-<br>
-void BTFDebug::visitArrayType(const DICompositeType *CTy) {<br>
- auto TypeEntry = llvm::make_unique<BTFTypeArray>(CTy);<br>
- addType(std::move(TypeEntry), CTy);<br>
-<br>
- // The IR does not have a type for array index while BTF wants one.<br>
- // So create an array index type if there is none.<br>
- if (!ArrayIndexTypeId) {<br>
- auto TypeEntry = llvm::make_unique<BTFTypeInt>(dwarf::DW_ATE_unsigned, 32,<br>
- 0, "__ARRAY_SIZE_TYPE__");<br>
- ArrayIndexTypeId = addType(std::move(TypeEntry));<br>
- }<br>
-<br>
- // Visit array element type.<br>
- visitTypeEntry(CTy->getBaseType().resolve());<br>
-}<br>
-<br>
-void BTFDebug::visitEnumType(const DICompositeType *CTy) {<br>
- DINodeArray Elements = CTy->getElements();<br>
- uint32_t VLen = Elements.size();<br>
- if (VLen > BTF::MAX_VLEN)<br>
- return;<br>
-<br>
- auto TypeEntry = llvm::make_unique<BTFTypeEnum>(CTy, VLen);<br>
- addType(std::move(TypeEntry), CTy);<br>
- // No need to visit base type as BTF does not encode it.<br>
-}<br>
-<br>
-/// Handle structure/union forward declarations.<br>
-void BTFDebug::visitFwdDeclType(const DICompositeType *CTy) {<br>
- auto TypeEntry = llvm::make_unique<BTFTypeFwd>(CTy->getName());<br>
- addType(std::move(TypeEntry), CTy);<br>
-}<br>
-<br>
-/// Handle structure, union, array and enumeration types.<br>
-void BTFDebug::visitCompositeType(const DICompositeType *CTy) {<br>
- auto Tag = CTy->getTag();<br>
- if (Tag == dwarf::DW_TAG_structure_type || Tag == dwarf::DW_TAG_union_type) {<br>
- // Handle forward declaration differently as it does not have members.<br>
- if (CTy->isForwardDecl())<br>
- visitFwdDeclType(CTy);<br>
- else<br>
- visitStructType(CTy, Tag == dwarf::DW_TAG_structure_type);<br>
- } else if (Tag == dwarf::DW_TAG_array_type)<br>
- visitArrayType(CTy);<br>
- else if (Tag == dwarf::DW_TAG_enumeration_type)<br>
- visitEnumType(CTy);<br>
-}<br>
-<br>
-/// Handle pointer, typedef, const, volatile, restrict and member types.<br>
-void BTFDebug::visitDerivedType(const DIDerivedType *DTy) {<br>
- unsigned Tag = DTy->getTag();<br>
-<br>
- if (Tag == dwarf::DW_TAG_pointer_type || Tag == dwarf::DW_TAG_typedef ||<br>
- Tag == dwarf::DW_TAG_const_type || Tag == dwarf::DW_TAG_volatile_type ||<br>
- Tag == dwarf::DW_TAG_restrict_type) {<br>
- auto TypeEntry = llvm::make_unique<BTFTypeDerived>(DTy, Tag);<br>
- addType(std::move(TypeEntry), DTy);<br>
- } else if (Tag != dwarf::DW_TAG_member) {<br>
- return;<br>
- } else {<br>
- // Special process member bitfield type.<br>
- // For bitfield, recursively find the base type and then<br>
- // construct a special int type with correct bitfield size.<br>
- // Install the type id in BitFieldTypeMap for later retrieval.<br>
- //<br>
- // FIXME: The real bitfield base type is lost. There<br>
- // is discussion to define a different type kind for<br>
- // bitfield in order to preserve its base type.<br>
- // Revisit this if the new kind or new mechanism is available.<br>
- if (DTy->isBitField()) {<br>
- const DIType *ResolvedTy = DTy->getBaseType().resolve();<br>
-<br>
- while (ResolvedTy) {<br>
- if (const auto *DerivedTy = dyn_cast<DIDerivedType>(ResolvedTy)) {<br>
- ResolvedTy = DerivedTy->getBaseType().resolve();<br>
- } else if (const auto *CompositeTy =<br>
- dyn_cast<DICompositeType>(ResolvedTy)) {<br>
- assert(CompositeTy->getTag() == dwarf::DW_TAG_enumeration_type &&<br>
- "Invalid member composite type");<br>
- ResolvedTy = CompositeTy->getBaseType().resolve();<br>
- } else<br>
- break;<br>
- }<br>
-<br>
- const auto *BaseTy = cast<DIBasicType>(ResolvedTy);<br>
- auto TypeEntry = llvm::make_unique<BTFTypeInt>(<br>
- BaseTy->getEncoding(), DTy->getSizeInBits(), 0, BaseTy->getName());<br>
- BitFieldTypeMap[DTy] = addType(std::move(TypeEntry));<br>
- return;<br>
- }<br>
- }<br>
-<br>
- // Visit base type of pointer, typedef, const, volatile, restrict or<br>
- // non-bitfield member type.<br>
- visitTypeEntry(DTy->getBaseType().resolve());<br>
-}<br>
-<br>
-void BTFDebug::visitTypeEntry(const DIType *Ty) {<br>
- if (!Ty || DIToIdMap.find(Ty) != DIToIdMap.end())<br>
- return;<br>
-<br>
- uint32_t TypeId;<br>
- if (const auto *BTy = dyn_cast<DIBasicType>(Ty))<br>
- visitBasicType(BTy);<br>
- else if (const auto *STy = dyn_cast<DISubroutineType>(Ty))<br>
- visitSubroutineType(STy, false, std::unordered_map<uint32_t, StringRef>(),<br>
- TypeId);<br>
- else if (const auto *CTy = dyn_cast<DICompositeType>(Ty))<br>
- visitCompositeType(CTy);<br>
- else if (const auto *DTy = dyn_cast<DIDerivedType>(Ty))<br>
- visitDerivedType(DTy);<br>
- else<br>
- llvm_unreachable("Unknown DIType");<br>
-}<br>
-<br>
-/// Read file contents from the actual file or from the source<br>
-std::string BTFDebug::populateFileContent(const DISubprogram *SP) {<br>
- auto File = SP->getFile();<br>
- std::string FileName;<br>
-<br>
- if (File->getDirectory().size())<br>
- FileName = File->getDirectory().str() + "/" + File->getFilename().str();<br>
- else<br>
- FileName = File->getFilename();<br>
-<br>
- // No need to populate the contends if it has been populated!<br>
- if (FileContent.find(FileName) != FileContent.end())<br>
- return FileName;<br>
-<br>
- std::vector<std::string> Content;<br>
- std::string Line;<br>
- Content.push_back(Line); // Line 0 for empty string<br>
-<br>
- auto Source = File->getSource();<br>
- if (Source) {<br>
- std::istringstream InputString(Source.getValue());<br>
- while (std::getline(InputString, Line))<br>
- Content.push_back(Line);<br>
- } else {<br>
- std::ifstream InputFile(FileName);<br>
- while (std::getline(InputFile, Line))<br>
- Content.push_back(Line);<br>
- }<br>
-<br>
- FileContent[FileName] = Content;<br>
- return FileName;<br>
-}<br>
-<br>
-void BTFDebug::constructLineInfo(const DISubprogram *SP, MCSymbol *Label,<br>
- uint32_t Line, uint32_t Column) {<br>
- std::string FileName = populateFileContent(SP);<br>
- BTFLineInfo LineInfo;<br>
-<br>
- LineInfo.Label = Label;<br>
- LineInfo.FileNameOff = addString(FileName);<br>
- // If file content is not available, let LineOff = 0.<br>
- if (Line < FileContent[FileName].size())<br>
- LineInfo.LineOff = addString(FileContent[FileName][Line]);<br>
- else<br>
- LineInfo.LineOff = 0;<br>
- LineInfo.LineNum = Line;<br>
- LineInfo.ColumnNum = Column;<br>
- LineInfoTable[SecNameOff].push_back(LineInfo);<br>
-}<br>
-<br>
-void BTFDebug::emitCommonHeader() {<br>
- OS.AddComment("0x" + Twine::utohexstr(BTF::MAGIC));<br>
- OS.EmitIntValue(BTF::MAGIC, 2);<br>
- OS.EmitIntValue(BTF::VERSION, 1);<br>
- OS.EmitIntValue(0, 1);<br>
-}<br>
-<br>
-void BTFDebug::emitBTFSection() {<br>
- MCContext &context = OS.getContext();<br>
- OS.SwitchSection(context.getObjectFileInfo()->getBTFSection());<br>
-<br>
- // Emit header.<br>
- emitCommonHeader();<br>
- OS.EmitIntValue(BTF::HeaderSize, 4);<br>
-<br>
- uint32_t TypeLen = 0, StrLen;<br>
- for (const auto &TypeEntry : TypeEntries)<br>
- TypeLen += TypeEntry->getSize();<br>
- StrLen = StringTable.getSize();<br>
-<br>
- OS.EmitIntValue(0, 4);<br>
- OS.EmitIntValue(TypeLen, 4);<br>
- OS.EmitIntValue(TypeLen, 4);<br>
- OS.EmitIntValue(StrLen, 4);<br>
-<br>
- // Emit type table.<br>
- for (const auto &TypeEntry : TypeEntries)<br>
- TypeEntry->emitType(OS);<br>
-<br>
- // Emit string table.<br>
- uint32_t StringOffset = 0;<br>
- for (const auto &S : StringTable.getTable()) {<br>
- OS.AddComment("string offset=" + std::to_string(StringOffset));<br>
- OS.EmitBytes(S);<br>
- OS.EmitBytes(StringRef("\0", 1));<br>
- StringOffset += S.size() + 1;<br>
- }<br>
-}<br>
-<br>
-void BTFDebug::emitBTFExtSection() {<br>
- MCContext &context = OS.getContext();<br>
- OS.SwitchSection(context.getObjectFileInfo()->getBTFExtSection());<br>
-<br>
- // Emit header.<br>
- emitCommonHeader();<br>
- OS.EmitIntValue(BTF::ExtHeaderSize, 4);<br>
-<br>
- // Account for FuncInfo/LineInfo record size as well.<br>
- uint32_t FuncLen = 4, LineLen = 4;<br>
- for (const auto &FuncSec : FuncInfoTable) {<br>
- FuncLen += BTF::SecFuncInfoSize;<br>
- FuncLen += FuncSec.second.size() * BTF::BPFFuncInfoSize;<br>
- }<br>
- for (const auto &LineSec : LineInfoTable) {<br>
- LineLen += BTF::SecLineInfoSize;<br>
- LineLen += LineSec.second.size() * BTF::BPFLineInfoSize;<br>
- }<br>
-<br>
- OS.EmitIntValue(0, 4);<br>
- OS.EmitIntValue(FuncLen, 4);<br>
- OS.EmitIntValue(FuncLen, 4);<br>
- OS.EmitIntValue(LineLen, 4);<br>
-<br>
- // Emit func_info table.<br>
- OS.AddComment("FuncInfo");<br>
- OS.EmitIntValue(BTF::BPFFuncInfoSize, 4);<br>
- for (const auto &FuncSec : FuncInfoTable) {<br>
- OS.AddComment("FuncInfo section string offset=" +<br>
- std::to_string(FuncSec.first));<br>
- OS.EmitIntValue(FuncSec.first, 4);<br>
- OS.EmitIntValue(FuncSec.second.size(), 4);<br>
- for (const auto &FuncInfo : FuncSec.second) {<br>
- Asm->EmitLabelReference(FuncInfo.Label, 4);<br>
- OS.EmitIntValue(FuncInfo.TypeId, 4);<br>
- }<br>
- }<br>
-<br>
- // Emit line_info table.<br>
- OS.AddComment("LineInfo");<br>
- OS.EmitIntValue(BTF::BPFLineInfoSize, 4);<br>
- for (const auto &LineSec : LineInfoTable) {<br>
- OS.AddComment("LineInfo section string offset=" +<br>
- std::to_string(LineSec.first));<br>
- OS.EmitIntValue(LineSec.first, 4);<br>
- OS.EmitIntValue(LineSec.second.size(), 4);<br>
- for (const auto &LineInfo : LineSec.second) {<br>
- Asm->EmitLabelReference(LineInfo.Label, 4);<br>
- OS.EmitIntValue(LineInfo.FileNameOff, 4);<br>
- OS.EmitIntValue(LineInfo.LineOff, 4);<br>
- OS.AddComment("Line " + std::to_string(LineInfo.LineNum) + " Col " +<br>
- std::to_string(LineInfo.ColumnNum));<br>
- OS.EmitIntValue(LineInfo.LineNum << 10 | LineInfo.ColumnNum, 4);<br>
- }<br>
- }<br>
-}<br>
-<br>
-void BTFDebug::beginFunctionImpl(const MachineFunction *MF) {<br>
- auto *SP = MF->getFunction().getSubprogram();<br>
- auto *Unit = SP->getUnit();<br>
-<br>
- if (Unit->getEmissionKind() == DICompileUnit::NoDebug) {<br>
- SkipInstruction = true;<br>
- return;<br>
- }<br>
- SkipInstruction = false;<br>
-<br>
- // Collect all types locally referenced in this function.<br>
- // Use RetainedNodes so we can collect all argument names<br>
- // even if the argument is not used.<br>
- std::unordered_map<uint32_t, StringRef> FuncArgNames;<br>
- for (const DINode *DN : SP->getRetainedNodes()) {<br>
- if (const auto *DV = dyn_cast<DILocalVariable>(DN)) {<br>
- visitTypeEntry(DV->getType().resolve());<br>
-<br>
- // Collect function arguments for subprogram func type.<br>
- uint32_t Arg = DV->getArg();<br>
- if (Arg)<br>
- FuncArgNames[Arg] = DV->getName();<br>
- }<br>
- }<br>
-<br>
- // Construct subprogram func proto type.<br>
- uint32_t ProtoTypeId;<br>
- visitSubroutineType(SP->getType(), true, FuncArgNames, ProtoTypeId);<br>
-<br>
- // Construct subprogram func type<br>
- auto FuncTypeEntry =<br>
- llvm::make_unique<BTFTypeFunc>(SP->getName(), ProtoTypeId);<br>
- uint32_t FuncTypeId = addType(std::move(FuncTypeEntry));<br>
-<br>
- // Construct funcinfo and the first lineinfo for the function.<br>
- MCSymbol *FuncLabel = Asm->getFunctionBegin();<br>
- BTFFuncInfo FuncInfo;<br>
- FuncInfo.Label = FuncLabel;<br>
- FuncInfo.TypeId = FuncTypeId;<br>
- if (FuncLabel->isInSection()) {<br>
- MCSection &Section = FuncLabel->getSection();<br>
- const MCSectionELF *SectionELF = dyn_cast<MCSectionELF>(&Section);<br>
- assert(SectionELF && "Null section for Function Label");<br>
- SecNameOff = addString(SectionELF->getSectionName());<br>
- } else {<br>
- SecNameOff = addString(".text");<br>
- }<br>
- FuncInfoTable[SecNameOff].push_back(FuncInfo);<br>
-}<br>
-<br>
-void BTFDebug::endFunctionImpl(const MachineFunction *MF) {<br>
- SkipInstruction = false;<br>
- LineInfoGenerated = false;<br>
- SecNameOff = 0;<br>
-}<br>
-<br>
-void BTFDebug::beginInstruction(const MachineInstr *MI) {<br>
- DebugHandlerBase::beginInstruction(MI);<br>
-<br>
- if (SkipInstruction || MI->isMetaInstruction() ||<br>
- MI->getFlag(MachineInstr::FrameSetup))<br>
- return;<br>
-<br>
- // Skip this instruction if no DebugLoc or the DebugLoc<br>
- // is the same as the previous instruction.<br>
- const DebugLoc &DL = MI->getDebugLoc();<br>
- if (!DL || PrevInstLoc == DL) {<br>
- // This instruction will be skipped, no LineInfo has<br>
- // been generated, construct one based on function signature.<br>
- if (LineInfoGenerated == false) {<br>
- auto *S = MI->getMF()->getFunction().getSubprogram();<br>
- MCSymbol *FuncLabel = Asm->getFunctionBegin();<br>
- constructLineInfo(S, FuncLabel, S->getLine(), 0);<br>
- LineInfoGenerated = true;<br>
- }<br>
-<br>
- return;<br>
- }<br>
-<br>
- // Create a temporary label to remember the insn for lineinfo.<br>
- MCSymbol *LineSym = OS.getContext().createTempSymbol();<br>
- OS.EmitLabel(LineSym);<br>
-<br>
- // Construct the lineinfo.<br>
- auto SP = DL.get()->getScope()->getSubprogram();<br>
- constructLineInfo(SP, LineSym, DL.getLine(), DL.getCol());<br>
-<br>
- LineInfoGenerated = true;<br>
- PrevInstLoc = DL;<br>
-}<br>
-<br>
-void BTFDebug::endModule() {<br>
- // Collect all types referenced by globals.<br>
- const Module *M = MMI->getModule();<br>
- for (const DICompileUnit *CUNode : M->debug_compile_units()) {<br>
- for (const auto *GVE : CUNode->getGlobalVariables()) {<br>
- DIGlobalVariable *GV = GVE->getVariable();<br>
- visitTypeEntry(GV->getType().resolve());<br>
- }<br>
- }<br>
-<br>
- // Complete BTF type cross refereences.<br>
- for (const auto &TypeEntry : TypeEntries)<br>
- TypeEntry->completeType(*this);<br>
-<br>
- // Emit BTF sections.<br>
- emitBTFSection();<br>
- emitBTFExtSection();<br>
-}<br>
<br>
Removed: llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.h?rev=348003&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.h?rev=348003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebug.h (removed)<br>
@@ -1,293 +0,0 @@<br>
-//===- llvm/lib/CodeGen/AsmPrinter/BTFDebug.h -------------------*- C++ -*-===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-///<br>
-/// \file<br>
-/// This file contains support for writing BTF debug info.<br>
-///<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_BTFDEBUG_H<br>
-#define LLVM_LIB_CODEGEN_ASMPRINTER_BTFDEBUG_H<br>
-<br>
-#include "DebugHandlerBase.h"<br>
-#include "llvm/ADT/StringMap.h"<br>
-#include "llvm/BinaryFormat/BTF.h"<br>
-#include <unordered_map><br>
-<br>
-namespace llvm {<br>
-<br>
-class AsmPrinter;<br>
-class BTFDebug;<br>
-class DIType;<br>
-class MCStreamer;<br>
-class MCSymbol;<br>
-class MachineFunction;<br>
-<br>
-/// The base class for BTF type generation.<br>
-class BTFTypeBase {<br>
-protected:<br>
- uint8_t Kind;<br>
- uint32_t Id;<br>
- struct BTF::CommonType BTFType;<br>
-<br>
-public:<br>
- virtual ~BTFTypeBase() = default;<br>
- void setId(uint32_t Id) { this->Id = Id; }<br>
- uint32_t getId() { return Id; }<br>
- uint32_t roundupToBytes(uint32_t NumBits) { return (NumBits + 7) >> 3; }<br>
- /// Get the size of this BTF type entry.<br>
- virtual uint32_t getSize() { return BTF::CommonTypeSize; }<br>
- /// Complete BTF type generation after all related DebugInfo types<br>
- /// have been visited so their BTF type id's are available<br>
- /// for cross referece.<br>
- virtual void completeType(BTFDebug &BDebug) {}<br>
- /// Emit types for this BTF type entry.<br>
- virtual void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle several derived types include pointer, const,<br>
-/// volatile, typedef and restrict.<br>
-class BTFTypeDerived : public BTFTypeBase {<br>
- const DIDerivedType *DTy;<br>
-<br>
-public:<br>
- BTFTypeDerived(const DIDerivedType *Ty, unsigned Tag);<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle struct or union forward declaration.<br>
-class BTFTypeFwd : public BTFTypeBase {<br>
- StringRef Name;<br>
-<br>
-public:<br>
- BTFTypeFwd(StringRef Name);<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle int type.<br>
-class BTFTypeInt : public BTFTypeBase {<br>
- StringRef Name;<br>
- uint32_t IntVal; ///< Encoding, offset, bits<br>
-<br>
-public:<br>
- BTFTypeInt(uint32_t Encoding, uint32_t SizeInBits, uint32_t OffsetInBits,<br>
- StringRef TypeName);<br>
- uint32_t getSize() { return BTFTypeBase::getSize() + sizeof(uint32_t); }<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle enumerate type.<br>
-class BTFTypeEnum : public BTFTypeBase {<br>
- const DICompositeType *ETy;<br>
- std::vector<struct BTF::BTFEnum> EnumValues;<br>
-<br>
-public:<br>
- BTFTypeEnum(const DICompositeType *ETy, uint32_t NumValues);<br>
- uint32_t getSize() {<br>
- return BTFTypeBase::getSize() + EnumValues.size() * BTF::BTFEnumSize;<br>
- }<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle array type.<br>
-class BTFTypeArray : public BTFTypeBase {<br>
- const DICompositeType *ATy;<br>
- struct BTF::BTFArray ArrayInfo;<br>
-<br>
-public:<br>
- BTFTypeArray(const DICompositeType *ATy);<br>
- uint32_t getSize() { return BTFTypeBase::getSize() + BTF::BTFArraySize; }<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle struct/union type.<br>
-class BTFTypeStruct : public BTFTypeBase {<br>
- const DICompositeType *STy;<br>
- std::vector<struct BTF::BTFMember> Members;<br>
-<br>
-public:<br>
- BTFTypeStruct(const DICompositeType *STy, bool IsStruct, uint32_t NumMembers);<br>
- uint32_t getSize() {<br>
- return BTFTypeBase::getSize() + Members.size() * BTF::BTFMemberSize;<br>
- }<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle function pointer.<br>
-class BTFTypeFuncProto : public BTFTypeBase {<br>
- const DISubroutineType *STy;<br>
- std::unordered_map<uint32_t, StringRef> FuncArgNames;<br>
- std::vector<struct BTF::BTFParam> Parameters;<br>
-<br>
-public:<br>
- BTFTypeFuncProto(const DISubroutineType *STy, uint32_t NumParams,<br>
- const std::unordered_map<uint32_t, StringRef> &FuncArgNames);<br>
- uint32_t getSize() {<br>
- return BTFTypeBase::getSize() + Parameters.size() * BTF::BTFParamSize;<br>
- }<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// Handle subprogram<br>
-class BTFTypeFunc : public BTFTypeBase {<br>
- StringRef Name;<br>
-<br>
-public:<br>
- BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId);<br>
- uint32_t getSize() { return BTFTypeBase::getSize(); }<br>
- void completeType(BTFDebug &BDebug);<br>
- void emitType(MCStreamer &OS);<br>
-};<br>
-<br>
-/// String table.<br>
-class BTFStringTable {<br>
- /// String table size in bytes.<br>
- uint32_t Size;<br>
- /// A mapping from string table offset to the index<br>
- /// of the Table. It is used to avoid putting<br>
- /// duplicated strings in the table.<br>
- std::unordered_map<uint32_t, uint32_t> OffsetToIdMap;<br>
- /// A vector of strings to represent the string table.<br>
- std::vector<std::string> Table;<br>
-<br>
-public:<br>
- BTFStringTable() : Size(0) {}<br>
- uint32_t getSize() { return Size; }<br>
- std::vector<std::string> &getTable() { return Table; }<br>
- /// Add a string to the string table and returns its offset<br>
- /// in the table.<br>
- uint32_t addString(StringRef S);<br>
-};<br>
-<br>
-/// Represent one func and its type id.<br>
-struct BTFFuncInfo {<br>
- const MCSymbol *Label; ///< Func MCSymbol<br>
- uint32_t TypeId; ///< Type id referring to .BTF type section<br>
-};<br>
-<br>
-/// Represent one line info.<br>
-struct BTFLineInfo {<br>
- MCSymbol *Label; ///< MCSymbol identifying insn for the lineinfo<br>
- uint32_t FileNameOff; ///< file name offset in the .BTF string table<br>
- uint32_t LineOff; ///< line offset in the .BTF string table<br>
- uint32_t LineNum; ///< the line number<br>
- uint32_t ColumnNum; ///< the column number<br>
-};<br>
-<br>
-/// Collect and emit BTF information.<br>
-class BTFDebug : public DebugHandlerBase {<br>
- MCStreamer &OS;<br>
- bool SkipInstruction;<br>
- bool LineInfoGenerated;<br>
- uint32_t SecNameOff;<br>
- uint32_t ArrayIndexTypeId;<br>
- BTFStringTable StringTable;<br>
- std::vector<std::unique_ptr<BTFTypeBase>> TypeEntries;<br>
- std::unordered_map<const DIType *, uint32_t> DIToIdMap;<br>
- std::unordered_map<const DIType *, uint32_t> BitFieldTypeMap;<br>
- std::unordered_map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable;<br>
- std::unordered_map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;<br>
- StringMap<std::vector<std::string>> FileContent;<br>
-<br>
- /// Add types to TypeEntries.<br>
- /// @{<br>
- /// Add types to TypeEntries and DIToIdMap.<br>
- void addType(std::unique_ptr<BTFTypeBase> TypeEntry, const DIType *Ty);<br>
- /// Add types to TypeEntries only and return type id.<br>
- uint32_t addType(std::unique_ptr<BTFTypeBase> TypeEntry);<br>
- /// @}<br>
-<br>
- /// IR type visiting functions.<br>
- /// @{<br>
- void visitTypeEntry(const DIType *Ty);<br>
- void visitBasicType(const DIBasicType *BTy);<br>
- void visitSubroutineType(<br>
- const DISubroutineType *STy, bool ForSubprog,<br>
- const std::unordered_map<uint32_t, StringRef> &FuncArgNames,<br>
- uint32_t &TypeId);<br>
- void visitFwdDeclType(const DICompositeType *CTy);<br>
- void visitCompositeType(const DICompositeType *CTy);<br>
- void visitStructType(const DICompositeType *STy, bool IsStruct);<br>
- void visitArrayType(const DICompositeType *ATy);<br>
- void visitEnumType(const DICompositeType *ETy);<br>
- void visitDerivedType(const DIDerivedType *DTy);<br>
- /// @}<br>
-<br>
- /// Get the file content for the subprogram. Certain lines of the file<br>
- /// later may be put into string table and referenced by line info.<br>
- std::string populateFileContent(const DISubprogram *SP);<br>
-<br>
- /// Construct a line info.<br>
- void constructLineInfo(const DISubprogram *SP, MCSymbol *Label, uint32_t Line,<br>
- uint32_t Column);<br>
-<br>
- /// Emit common header of .BTF and .BTF.ext sections.<br>
- void emitCommonHeader();<br>
-<br>
- /// Emit the .BTF section.<br>
- void emitBTFSection();<br>
-<br>
- /// Emit the .BTF.ext section.<br>
- void emitBTFExtSection();<br>
-<br>
-protected:<br>
- /// Gather pre-function debug information.<br>
- void beginFunctionImpl(const MachineFunction *MF) override;<br>
-<br>
- /// Post process after all instructions in this function are processed.<br>
- void endFunctionImpl(const MachineFunction *MF) override;<br>
-<br>
-public:<br>
- BTFDebug(AsmPrinter *AP);<br>
-<br>
- /// Get the special array index type id.<br>
- uint32_t getArrayIndexTypeId() {<br>
- assert(ArrayIndexTypeId);<br>
- return ArrayIndexTypeId;<br>
- }<br>
-<br>
- /// Add string to the string table.<br>
- size_t addString(StringRef S) { return StringTable.addString(S); }<br>
-<br>
- /// Get the type id for a particular DIType.<br>
- uint32_t getTypeId(const DIType *Ty) {<br>
- assert(Ty && "Invalid null Type");<br>
- assert(DIToIdMap.find(Ty) != DIToIdMap.end() &&<br>
- "DIType not added in the BDIToIdMap");<br>
- return DIToIdMap[Ty];<br>
- }<br>
-<br>
- /// Get the bitfield type id. If the struct/union member<br>
- /// is a bitfield, a special type is created for it.<br>
- uint32_t getBitFieldTypeId(const DIDerivedType *Ty) {<br>
- assert(Ty && "Invalid null Type");<br>
- assert(BitFieldTypeMap.find(Ty) != BitFieldTypeMap.end() &&<br>
- "DIDerivedType not added in the BitFieldTypeMap");<br>
- return BitFieldTypeMap[Ty];<br>
- }<br>
-<br>
- void setSymbolSize(const MCSymbol *Symbol, uint64_t Size) override {}<br>
-<br>
- /// Process beginning of an instruction.<br>
- void beginInstruction(const MachineInstr *MI) override;<br>
-<br>
- /// Complete all the types and emit the BTF sections.<br>
- void endModule() override;<br>
-};<br>
-<br>
-} // end namespace llvm<br>
-<br>
-#endif // LLVM_LIB_CODEGEN_ASMPRINTER_BTFDEBUG_H<br>
<br>
Removed: llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebugStub.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebugStub.cpp?rev=348003&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebugStub.cpp?rev=348003&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebugStub.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/BTFDebugStub.cpp (removed)<br>
@@ -1,28 +0,0 @@<br>
-//===- llvm/lib/CodeGen/AsmPrinter/BTFDebugStub.cpp -------------*- C++ -*-===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-///<br>
-/// \file<br>
-/// This file is a stub for BTF generation support. The real implementation<br>
-/// is at BTFDebug.cpp which will be included if BPF target is built.<br>
-///<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include "DebugHandlerBase.h"<br>
-<br>
-namespace llvm {<br>
-<br>
-/// Stub class for emitting the BTF .<br>
-class BTFDebug : public DebugHandlerBase {<br>
-public:<br>
- BTFDebug(AsmPrinter *AP);<br>
-};<br>
-<br>
-BTFDebug::BTFDebug(AsmPrinter *AP) : DebugHandlerBase(AP) {}<br>
-<br>
-} // end namespace llvm<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt?rev=348004&r1=348003&r2=348004&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt?rev=348004&r1=348003&r2=348004&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt Fri Nov 30 08:54:43 2018<br>
@@ -1,14 +1,3 @@<br>
-# Based on whether BPF target is built or not,<br>
-# either BTFDebug.cpp or BTFDebugStub.cpp will be included,<br>
-# but not both.<br>
-set(LLVM_OPTIONAL_SOURCES "BTFDebug.cpp" "BTFDebugStub.cpp")<br>
-list(FIND LLVM_TARGETS_TO_BUILD "BPF" idx)<br>
-if( NOT idx LESS 0 )<br>
- set(BTFDebug_File "BTFDebug.cpp")<br>
-else()<br>
- set(BTFDebug_File "BTFDebugStub.cpp")<br>
-endif()<br>
-<br>
add_llvm_library(LLVMAsmPrinter<br>
AccelTable.cpp<br>
AddressPool.cpp<br>
@@ -35,7 +24,6 @@ add_llvm_library(LLVMAsmPrinter<br>
WinException.cpp<br>
CodeViewDebug.cpp<br>
WasmException.cpp<br>
- ${BTFDebug_File}<br>
<br>
DEPENDS<br>
intrinsics_gen<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp?rev=348004&r1=348003&r2=348004&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp?rev=348004&r1=348003&r2=348004&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp Fri Nov 30 08:54:43 2018<br>
@@ -8,7 +8,7 @@<br>
//===----------------------------------------------------------------------===//<br>
//<br>
// Common functionality for different debug information format backends.<br>
-// LLVM currently supports DWARF, CodeView and BTF.<br>
+// LLVM currently supports DWARF and CodeView.<br>
//<br>
//===----------------------------------------------------------------------===//<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h?rev=348004&r1=348003&r2=348004&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h?rev=348004&r1=348003&r2=348004&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.h Fri Nov 30 08:54:43 2018<br>
@@ -8,7 +8,7 @@<br>
//===----------------------------------------------------------------------===//<br>
//<br>
// Common functionality for different debug information format backends.<br>
-// LLVM currently supports DWARF, CodeView and BTF.<br>
+// LLVM currently supports DWARF and CodeView.<br>
//<br>
//===----------------------------------------------------------------------===//<br>
<br>
<br>
Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=348004&r1=348003&r2=348004&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=348004&r1=348003&r2=348004&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Fri Nov 30 08:54:43 2018<br>
@@ -476,9 +476,6 @@ void MCObjectFileInfo::initELFMCObjectFi<br>
Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);<br>
<br>
StackSizesSection = Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, 0);<br>
-<br>
- BTFSection = Ctx->getELFSection(".BTF", ELF::SHT_PROGBITS, 0);<br>
- BTFExtSection = Ctx->getELFSection(".BTF.ext", ELF::SHT_PROGBITS, 0);<br>
}<br>
<br>
void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>