File indexing completed on 2026-05-10 08:43:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLINE_H
0015 #define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVLINE_H
0016
0017 #include "llvm/DebugInfo/LogicalView/Core/LVElement.h"
0018
0019 namespace llvm {
0020 namespace logicalview {
0021
0022 enum class LVLineKind {
0023 IsBasicBlock,
0024 IsDiscriminator,
0025 IsEndSequence,
0026 IsEpilogueBegin,
0027 IsLineDebug,
0028 IsLineAssembler,
0029 IsNewStatement,
0030 IsPrologueEnd,
0031 IsAlwaysStepInto,
0032 IsNeverStepInto,
0033 LastEntry
0034 };
0035 using LVLineKindSet = std::set<LVLineKind>;
0036 using LVLineDispatch = std::map<LVLineKind, LVLineGetFunction>;
0037 using LVLineRequest = std::vector<LVLineGetFunction>;
0038
0039
0040 class LVLine : public LVElement {
0041
0042 LVProperties<LVLineKind> Kinds;
0043 static LVLineDispatch Dispatch;
0044
0045
0046 LVLine *findIn(const LVLines *Targets) const;
0047
0048 public:
0049 LVLine() : LVElement(LVSubclassID::LV_LINE) {
0050 setIsLine();
0051 setIncludeInPrint();
0052 }
0053 LVLine(const LVLine &) = delete;
0054 LVLine &operator=(const LVLine &) = delete;
0055 virtual ~LVLine() = default;
0056
0057 static bool classof(const LVElement *Element) {
0058 return Element->getSubclassID() == LVSubclassID::LV_LINE;
0059 }
0060
0061 KIND(LVLineKind, IsBasicBlock);
0062 KIND(LVLineKind, IsDiscriminator);
0063 KIND(LVLineKind, IsEndSequence);
0064 KIND(LVLineKind, IsEpilogueBegin);
0065 KIND(LVLineKind, IsLineDebug);
0066 KIND(LVLineKind, IsLineAssembler);
0067 KIND(LVLineKind, IsNewStatement);
0068 KIND(LVLineKind, IsPrologueEnd);
0069 KIND(LVLineKind, IsAlwaysStepInto);
0070 KIND(LVLineKind, IsNeverStepInto);
0071
0072 const char *kind() const override;
0073
0074
0075 uint64_t getAddress() const { return getOffset(); }
0076 void setAddress(uint64_t address) { setOffset(address); }
0077
0078
0079 std::string noLineAsString(bool ShowZero = false) const override;
0080
0081
0082
0083 std::string lineNumberAsString(bool ShowZero = false) const override {
0084 return lineAsString(getLineNumber(), getDiscriminator(), ShowZero);
0085 }
0086
0087 static LVLineDispatch &getDispatch() { return Dispatch; }
0088
0089
0090
0091
0092 static void markMissingParents(const LVLines *References,
0093 const LVLines *Targets);
0094
0095
0096 virtual bool equals(const LVLine *Line) const;
0097
0098
0099
0100 static bool equals(const LVLines *References, const LVLines *Targets);
0101
0102
0103 void report(LVComparePass Pass) override;
0104
0105 void print(raw_ostream &OS, bool Full = true) const override;
0106 void printExtra(raw_ostream &OS, bool Full = true) const override {}
0107
0108 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
0109 void dump() const override { print(dbgs()); }
0110 #endif
0111 };
0112
0113
0114 class LVLineDebug final : public LVLine {
0115
0116
0117 uint32_t Discriminator = 0;
0118
0119 public:
0120 LVLineDebug() : LVLine() { setIsLineDebug(); }
0121 LVLineDebug(const LVLineDebug &) = delete;
0122 LVLineDebug &operator=(const LVLineDebug &) = delete;
0123 ~LVLineDebug() = default;
0124
0125
0126
0127 std::string statesInfo(bool Formatted) const;
0128
0129
0130 uint32_t getDiscriminator() const override { return Discriminator; }
0131 void setDiscriminator(uint32_t Value) override {
0132 Discriminator = Value;
0133 setIsDiscriminator();
0134 }
0135
0136
0137 bool equals(const LVLine *Line) const override;
0138
0139 void printExtra(raw_ostream &OS, bool Full = true) const override;
0140 };
0141
0142
0143 class LVLineAssembler final : public LVLine {
0144 public:
0145 LVLineAssembler() : LVLine() { setIsLineAssembler(); }
0146 LVLineAssembler(const LVLineAssembler &) = delete;
0147 LVLineAssembler &operator=(const LVLineAssembler &) = delete;
0148 ~LVLineAssembler() = default;
0149
0150
0151 std::string noLineAsString(bool ShowZero) const override {
0152 return std::string(8, ' ');
0153 };
0154
0155
0156 bool equals(const LVLine *Line) const override;
0157
0158 void printExtra(raw_ostream &OS, bool Full = true) const override;
0159 };
0160
0161 }
0162 }
0163
0164 #endif