LLVM: include/llvm/MC/MCCodeView.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_MC_MCCODEVIEW_H

14#define LLVM_MC_MCCODEVIEW_H

15

21#include

22#include

23#include

24

25namespace llvm {

35

36

37

38class MCCVLoc {

39 const MCSymbol *Label = nullptr;

46

47private:

49 MCCVLoc(const MCSymbol *Label, unsigned functionid, unsigned fileNum,

50 unsigned line, unsigned column, bool prologueend, bool isstmt)

51 : Label(Label), FunctionId(functionid), FileNum(fileNum), Line(line),

52 Column(column), PrologueEnd(prologueend), IsStmt(isstmt) {}

53

54

55

56

57public:

59

61

62

63 unsigned getFileNum() const { return FileNum; }

64

65

66 unsigned getLine() const { return Line; }

67

68

69 unsigned getColumn() const { return Column; }

70

72 bool isStmt() const { return IsStmt; }

73

75

77

78

79 void setFileNum(unsigned fileNum) { FileNum = fileNum; }

80

81

82 void setLine(unsigned line) { Line = line; }

83

84

86 assert(column <= UINT16_MAX);

87 Column = column;

88 }

89

92};

93

94

95

96

97

99

100

101

102

103

105

107

113

115

116

117

119

120

121

122

123

125

126

127

129

130

131

136

141};

142

143

145public:

147

150

152

156

157

158

160

161

162

163

164

166 unsigned IAFile, unsigned IALine,

167 unsigned IACol);

168

169

171

172

173

174

175

177 unsigned FileNo, unsigned Line, unsigned Column,

178 bool PrologueEnd, bool IsStmt);

179

180

182

184

185 std::pair<size_t, size_t> getLineExtent(unsigned FuncId);

187

189

190

194

196 unsigned PrimaryFunctionId,

197 unsigned SourceFileId,

198 unsigned SourceLineNum,

201

202

205

206 void

208 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,

210

212

213

215

216

218

219

221

222

223

225

226private:

228

229

231

232

233 MCFragment *StrTabFragment = nullptr;

235

236

237 unsigned getStringTableOffset(StringRef S);

238

239 struct FileInfo {

240 unsigned StringTableOffset;

241

242

243

244 bool Assigned = false;

245

247

249

250

251

252 MCSymbol *ChecksumTableOffset;

253 };

254

255

256 SmallVector<FileInfo, 4> Files;

257

258

259

260 std::map<unsigned, std::pair<size_t, size_t>> MCCVLineStartStop;

261

262

263 std::vector MCCVLines;

264

265

266 std::vector Functions;

267

268

269

270 bool ChecksumOffsetsAssigned = false;

271

272

273 std::deque<SmallVector<std::pair<const MCSymbol *, const MCSymbol *>, 0>>

274 DefRangeStorage;

275};

276

277}

278#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file defines the StringMap class.

This file defines the DenseMap class.

This file defines the SmallVector class.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

ArrayRef< MCCVLoc > getLinesForExtent(size_t L, size_t R)

std::pair< size_t, size_t > getLineExtent(unsigned FuncId)

void encodeInlineLineTable(const MCAssembler &Asm, MCCVInlineLineTableFragment &F)

Encodes the binary annotations once we have a layout.

void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd)

Emits a line table substream.

void emitFileChecksums(MCObjectStreamer &OS)

Emits the file checksum substream.

void recordCVLoc(MCContext &Ctx, const MCSymbol *Label, unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt)

Saves the information from the currently parsed .cv_loc directive and sets CVLocSeen.

void emitDefRange(MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)

CodeViewContext & operator=(const CodeViewContext &other)=delete

bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)

CodeViewContext(MCContext *MCCtx)

Definition MCCodeView.h:146

MCCVFunctionInfo * getCVFunctionInfo(unsigned FuncId)

Retreive the function info if this is a valid function id, or nullptr.

bool recordFunctionId(unsigned FuncId)

Records the function id of a normal function.

void emitFileChecksumOffset(MCObjectStreamer &OS, unsigned FileNo)

Emits the offset into the checksum table of the given file number.

std::vector< MCCVLoc > getFunctionLineEntries(unsigned FuncId)

void addLineEntry(const MCCVLoc &LineEntry)

Add a line entry.

bool recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol)

Records the function id of an inlined call site.

CodeViewContext(const CodeViewContext &other)=delete

std::pair< size_t, size_t > getLineExtentIncludingInlinees(unsigned FuncId)

void emitInlineLineTableForFunction(MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)

void emitStringTable(MCObjectStreamer &OS)

Emits the string table substream.

bool isValidFileNumber(unsigned FileNumber) const

This is a valid number for use with .cv_loc if we've already seen a .cv_file for it.

void encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &F)

std::pair< StringRef, unsigned > addToStringTable(StringRef S)

Add something to the string table.

Fragment representing the .cv_def_range directive.

Fragment representing the binary annotations produced by the .cv_inline_linetable directive.

Instances of this class represent the information from a .cv_loc directive.

Definition MCCodeView.h:38

void setFileNum(unsigned fileNum)

Set the FileNum of this MCCVLoc.

Definition MCCodeView.h:79

void setPrologueEnd(bool PE)

Definition MCCodeView.h:90

unsigned getLine() const

Get the Line of this MCCVLoc.

Definition MCCodeView.h:66

void setColumn(unsigned column)

Set the Column of this MCCVLoc.

Definition MCCodeView.h:85

unsigned getFileNum() const

Get the FileNum of this MCCVLoc.

Definition MCCodeView.h:63

friend class CodeViewContext

Definition MCCodeView.h:48

void setFunctionId(unsigned FID)

Definition MCCodeView.h:76

bool isPrologueEnd() const

Definition MCCodeView.h:71

void setIsStmt(bool IS)

Definition MCCodeView.h:91

bool isStmt() const

Definition MCCodeView.h:72

const MCSymbol * getLabel() const

Definition MCCodeView.h:58

void setLabel(const MCSymbol *L)

Definition MCCodeView.h:74

unsigned getColumn() const

Get the Column of this MCCVLoc.

Definition MCCodeView.h:69

unsigned getFunctionId() const

Definition MCCodeView.h:60

void setLine(unsigned line)

Set the Line of this MCCVLoc.

Definition MCCodeView.h:82

Context object for machine code objects.

Streaming object file generation interface.

Instances of this class represent a uniqued identifier for a section in the current translation unit.

Streaming machine code generation interface.

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...

StringRef - Represent a constant reference to a string, i.e.

This class represents a function that is read from a sample profile.

This is an optimization pass for GlobalISel generic memory operations.

Definition MCCodeView.h:108

unsigned Line

Definition MCCodeView.h:110

unsigned File

Definition MCCodeView.h:109

unsigned Col

Definition MCCodeView.h:111

Information describing a function or inlined call site introduced by .cv_func_id or ....

Definition MCCodeView.h:98

bool isInlinedCallSite() const

Returns true if this represents an inlined call site, meaning ParentFuncIdPlusOne is neither zero nor...

Definition MCCodeView.h:132

LineInfo InlinedAt

Definition MCCodeView.h:114

@ FunctionSentinel

Definition MCCodeView.h:106

MCSection * Section

The section of the first .cv_loc directive used for this function, or null if none has been seen yet.

Definition MCCodeView.h:118

unsigned ParentFuncIdPlusOne

If this represents an inlined call site, then ParentFuncIdPlusOne will be the parent function id plus...

Definition MCCodeView.h:104

unsigned getParentFuncId() const

Definition MCCodeView.h:137

bool isUnallocatedFunctionInfo() const

Returns true if this is function info has not yet been used in a .cv_func_id or .cv_inline_site_id di...

Definition MCCodeView.h:128

DenseMap< unsigned, LineInfo > InlinedAtMap

Map from inlined call site id to the inlined at location to use for that call site.

Definition MCCodeView.h:124