aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/BPF/BTFDebug.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/BPF/BTFDebug.h')
-rw-r--r--lib/Target/BPF/BTFDebug.h29
1 files changed, 7 insertions, 22 deletions
diff --git a/lib/Target/BPF/BTFDebug.h b/lib/Target/BPF/BTFDebug.h
index 6c0cdde17d9b..c01e0d1d1612 100644
--- a/lib/Target/BPF/BTFDebug.h
+++ b/lib/Target/BPF/BTFDebug.h
@@ -104,15 +104,13 @@ public:
/// Handle array type.
class BTFTypeArray : public BTFTypeBase {
- uint32_t ElemSize;
struct BTF::BTFArray ArrayInfo;
public:
- BTFTypeArray(uint32_t ElemTypeId, uint32_t ElemSize, uint32_t NumElems);
+ BTFTypeArray(uint32_t ElemTypeId, uint32_t NumElems);
uint32_t getSize() { return BTFTypeBase::getSize() + BTF::BTFArraySize; }
void completeType(BTFDebug &BDebug);
void emitType(MCStreamer &OS);
- void getLocInfo(uint32_t Loc, uint32_t &LocOffset, uint32_t &ElementTypeId);
};
/// Handle struct/union type.
@@ -130,8 +128,6 @@ public:
void completeType(BTFDebug &BDebug);
void emitType(MCStreamer &OS);
std::string getName();
- void getMemberInfo(uint32_t Loc, uint32_t &Offset, uint32_t &MemberType);
- uint32_t getStructSize();
};
/// Handle function pointer.
@@ -199,7 +195,7 @@ class BTFStringTable {
/// A mapping from string table offset to the index
/// of the Table. It is used to avoid putting
/// duplicated strings in the table.
- std::unordered_map<uint32_t, uint32_t> OffsetToIdMap;
+ std::map<uint32_t, uint32_t> OffsetToIdMap;
/// A vector of strings to represent the string table.
std::vector<std::string> Table;
@@ -228,16 +224,11 @@ struct BTFLineInfo {
};
/// Represent one offset relocation.
-struct BTFOffsetReloc {
+struct BTFFieldReloc {
const MCSymbol *Label; ///< MCSymbol identifying insn for the reloc
uint32_t TypeID; ///< Type ID
uint32_t OffsetNameOff; ///< The string to traverse types
-};
-
-/// Represent one extern relocation.
-struct BTFExternReloc {
- const MCSymbol *Label; ///< MCSymbol identifying insn for the reloc
- uint32_t ExternNameOff; ///< The extern variable name
+ uint32_t RelocKind; ///< What to patch the instruction
};
/// Collect and emit BTF information.
@@ -253,13 +244,11 @@ class BTFDebug : public DebugHandlerBase {
std::unordered_map<const DIType *, uint32_t> DIToIdMap;
std::map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable;
std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable;
- std::map<uint32_t, std::vector<BTFOffsetReloc>> OffsetRelocTable;
- std::map<uint32_t, std::vector<BTFExternReloc>> ExternRelocTable;
+ std::map<uint32_t, std::vector<BTFFieldReloc>> FieldRelocTable;
StringMap<std::vector<std::string>> FileContent;
std::map<std::string, std::unique_ptr<BTFKindDataSec>> DataSecEntries;
std::vector<BTFTypeStruct *> StructTypes;
- std::vector<BTFTypeArray *> ArrayTypes;
- std::map<std::string, int64_t> AccessOffsets;
+ std::map<std::string, uint32_t> PatchImms;
std::map<StringRef, std::pair<bool, std::vector<BTFTypeDerived *>>>
FixupDerivedTypes;
@@ -305,13 +294,9 @@ class BTFDebug : public DebugHandlerBase {
void processGlobals(bool ProcessingMapDef);
/// Generate one offset relocation record.
- void generateOffsetReloc(const MachineInstr *MI, const MCSymbol *ORSym,
+ void generateFieldReloc(const MachineInstr *MI, const MCSymbol *ORSym,
DIType *RootTy, StringRef AccessPattern);
- /// Set the to-be-traversed Struct/Array Type based on TypeId.
- void setTypeFromId(uint32_t TypeId, BTFTypeStruct **PrevStructType,
- BTFTypeArray **PrevArrayType);
-
/// Populating unprocessed struct type.
unsigned populateStructType(const DIType *Ty);