LLVM  14.0.0git
MCPseudoProbe.cpp
Go to the documentation of this file.
1 //===- lib/MC/MCPseudoProbe.cpp - Pseudo probe encoding support ----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/MC/MCAsmInfo.h"
11 #include "llvm/MC/MCContext.h"
14 #include "llvm/MC/MCStreamer.h"
15 #include "llvm/Support/Endian.h"
16 #include "llvm/Support/LEB128.h"
18 #include <limits>
19 #include <memory>
20 
21 #define DEBUG_TYPE "mcpseudoprobe"
22 
23 using namespace llvm;
24 using namespace support;
25 
26 #ifndef NDEBUG
28 #endif
29 
30 static const MCExpr *buildSymbolDiff(MCObjectStreamer *MCOS, const MCSymbol *A,
31  const MCSymbol *B) {
32  MCContext &Context = MCOS->getContext();
34  const MCExpr *ARef = MCSymbolRefExpr::create(A, Variant, Context);
35  const MCExpr *BRef = MCSymbolRefExpr::create(B, Variant, Context);
36  const MCExpr *AddrDelta =
38  return AddrDelta;
39 }
40 
42  const MCPseudoProbe *LastProbe) const {
43  // Emit Index
45  // Emit Type and the flag:
46  // Type (bit 0 to 3), with bit 4 to 6 for attributes.
47  // Flag (bit 7, 0 - code address, 1 - address delta). This indicates whether
48  // the following field is a symbolic code address or an address delta.
49  assert(Type <= 0xF && "Probe type too big to encode, exceeding 15");
50  assert(Attributes <= 0x7 &&
51  "Probe attributes too big to encode, exceeding 7");
52  uint8_t PackedType = Type | (Attributes << 4);
53  uint8_t Flag = LastProbe ? ((int8_t)MCPseudoProbeFlag::AddressDelta << 7) : 0;
54  MCOS->emitInt8(Flag | PackedType);
55 
56  if (LastProbe) {
57  // Emit the delta between the address label and LastProbe.
58  const MCExpr *AddrDelta =
59  buildSymbolDiff(MCOS, Label, LastProbe->getLabel());
60  int64_t Delta;
61  if (AddrDelta->evaluateAsAbsolute(Delta, MCOS->getAssemblerPtr())) {
62  MCOS->emitSLEB128IntValue(Delta);
63  } else {
64  MCOS->insert(new MCPseudoProbeAddrFragment(AddrDelta));
65  }
66  } else {
67  // Emit label as a symbolic code address.
68  MCOS->emitSymbolValue(
69  Label, MCOS->getContext().getAsmInfo()->getCodePointerSize());
70  }
71 
72  LLVM_DEBUG({
74  dbgs() << "Probe: " << Index << "\n";
75  });
76 }
77 
79  const MCPseudoProbe &Probe, const MCPseudoProbeInlineStack &InlineStack) {
80  // The function should not be called on the root.
81  assert(isRoot() && "Should not be called on root");
82 
83  // When it comes here, the input look like:
84  // Probe: GUID of C, ...
85  // InlineStack: [88, A], [66, B]
86  // which means, Function A inlines function B at call site with a probe id of
87  // 88, and B inlines C at probe 66. The tri-tree expects a tree path like {[0,
88  // A], [88, B], [66, C]} to locate the tree node where the probe should be
89  // added. Note that the edge [0, A] means A is the top-level function we are
90  // emitting probes for.
91 
92  // Make a [0, A] edge.
93  // An empty inline stack means the function that the probe originates from
94  // is a top-level function.
95  InlineSite Top;
96  if (InlineStack.empty()) {
97  Top = InlineSite(Probe.getGuid(), 0);
98  } else {
99  Top = InlineSite(std::get<0>(InlineStack.front()), 0);
100  }
101 
102  auto *Cur = getOrAddNode(Top);
103 
104  // Make interior edges by walking the inline stack. Once it's done, Cur should
105  // point to the node that the probe originates from.
106  if (!InlineStack.empty()) {
107  auto Iter = InlineStack.begin();
108  auto Index = std::get<1>(*Iter);
109  Iter++;
110  for (; Iter != InlineStack.end(); Iter++) {
111  // Make an edge by using the previous probe id and current GUID.
112  Cur = Cur->getOrAddNode(InlineSite(std::get<0>(*Iter), Index));
113  Index = std::get<1>(*Iter);
114  }
115  Cur = Cur->getOrAddNode(InlineSite(Probe.getGuid(), Index));
116  }
117 
118  Cur->Probes.push_back(Probe);
119 }
120 
122  const MCPseudoProbe *&LastProbe) {
123  LLVM_DEBUG({
125  dbgs() << "Group [\n";
127  });
128  // Emit probes grouped by GUID.
129  if (Guid != 0) {
130  LLVM_DEBUG({
132  dbgs() << "GUID: " << Guid << "\n";
133  });
134  // Emit Guid
135  MCOS->emitInt64(Guid);
136  // Emit number of probes in this node
137  MCOS->emitULEB128IntValue(Probes.size());
138  // Emit number of direct inlinees
139  MCOS->emitULEB128IntValue(Children.size());
140  // Emit probes in this group
141  for (const auto &Probe : Probes) {
142  Probe.emit(MCOS, LastProbe);
143  LastProbe = &Probe;
144  }
145  } else {
146  assert(Probes.empty() && "Root should not have probes");
147  }
148 
149  // Emit sorted descendant
150  // InlineSite is unique for each pair,
151  // so there will be no ordering of Inlinee based on MCPseudoProbeInlineTree*
152  std::map<InlineSite, MCPseudoProbeInlineTree *> Inlinees;
153  for (auto Child = Children.begin(); Child != Children.end(); ++Child)
154  Inlinees[Child->first] = Child->second.get();
155 
156  for (const auto &Inlinee : Inlinees) {
157  if (Guid) {
158  // Emit probe index
159  MCOS->emitULEB128IntValue(std::get<1>(Inlinee.first));
160  LLVM_DEBUG({
162  dbgs() << "InlineSite: " << std::get<1>(Inlinee.first) << "\n";
163  });
164  }
165  // Emit the group
166  Inlinee.second->emit(MCOS, LastProbe);
167  }
168 
169  LLVM_DEBUG({
172  dbgs() << "]\n";
173  });
174 }
175 
177  MCContext &Ctx = MCOS->getContext();
178 
179  for (auto &ProbeSec : MCProbeDivisions) {
180  const MCPseudoProbe *LastProbe = nullptr;
181  if (auto *S =
182  Ctx.getObjectFileInfo()->getPseudoProbeSection(ProbeSec.first)) {
183  // Switch to the .pseudoprobe section or a comdat group.
184  MCOS->SwitchSection(S);
185  // Emit probes grouped by GUID.
186  ProbeSec.second.emit(MCOS, LastProbe);
187  }
188  }
189 }
190 
191 //
192 // This emits the pseudo probe tables.
193 //
195  MCContext &Ctx = MCOS->getContext();
196  auto &ProbeTable = Ctx.getMCPseudoProbeTable();
197 
198  // Bail out early so we don't switch to the pseudo_probe section needlessly
199  // and in doing so create an unnecessary (if empty) section.
200  auto &ProbeSections = ProbeTable.getProbeSections();
201  if (ProbeSections.empty())
202  return;
203 
205 
206  // Put out the probe.
207  ProbeSections.emit(MCOS);
208 }
209 
211  uint64_t GUID) {
212  auto It = GUID2FuncMAP.find(GUID);
213  assert(It != GUID2FuncMAP.end() &&
214  "Probe function must exist for a valid GUID");
215  return It->second.FuncName;
216 }
217 
219  OS << "GUID: " << FuncGUID << " Name: " << FuncName << "\n";
220  OS << "Hash: " << FuncHash << "\n";
221 }
222 
225  const GUIDProbeFunctionMap &GUID2FuncMAP) const {
226  uint32_t Begin = ContextStack.size();
227  MCDecodedPseudoProbeInlineTree *Cur = InlineTree;
228  // It will add the string of each node's inline site during iteration.
229  // Note that it won't include the probe's belonging function(leaf location)
230  while (Cur->hasInlineSite()) {
231  StringRef FuncName =
232  getProbeFNameForGUID(GUID2FuncMAP, std::get<0>(Cur->ISite));
233  ContextStack.emplace_back(
234  MCPseduoProbeFrameLocation(FuncName, std::get<1>(Cur->ISite)));
235  Cur = static_cast<MCDecodedPseudoProbeInlineTree *>(Cur->Parent);
236  }
237  // Make the ContextStack in caller-callee order
238  std::reverse(ContextStack.begin() + Begin, ContextStack.end());
239 }
240 
242  const GUIDProbeFunctionMap &GUID2FuncMAP) const {
243  std::ostringstream OContextStr;
245  getInlineContext(ContextStack, GUID2FuncMAP);
246  for (auto &Cxt : ContextStack) {
247  if (OContextStr.str().size())
248  OContextStr << " @ ";
249  OContextStr << Cxt.first.str() << ":" << Cxt.second;
250  }
251  return OContextStr.str();
252 }
253 
254 static const char *PseudoProbeTypeStr[3] = {"Block", "IndirectCall",
255  "DirectCall"};
256 
258  const GUIDProbeFunctionMap &GUID2FuncMAP,
259  bool ShowName) const {
260  OS << "FUNC: ";
261  if (ShowName) {
262  StringRef FuncName = getProbeFNameForGUID(GUID2FuncMAP, Guid);
263  OS << FuncName.str() << " ";
264  } else {
265  OS << Guid << " ";
266  }
267  OS << "Index: " << Index << " ";
268  OS << "Type: " << PseudoProbeTypeStr[static_cast<uint8_t>(Type)] << " ";
269  std::string InlineContextStr = getInlineContextStr(GUID2FuncMAP);
270  if (InlineContextStr.size()) {
271  OS << "Inlined: @ ";
272  OS << InlineContextStr;
273  }
274  OS << "\n";
275 }
276 
277 template <typename T> ErrorOr<T> MCPseudoProbeDecoder::readUnencodedNumber() {
278  if (Data + sizeof(T) > End) {
279  return std::error_code();
280  }
281  T Val = endian::readNext<T, little, unaligned>(Data);
282  return ErrorOr<T>(Val);
283 }
284 
285 template <typename T> ErrorOr<T> MCPseudoProbeDecoder::readUnsignedNumber() {
286  unsigned NumBytesRead = 0;
287  uint64_t Val = decodeULEB128(Data, &NumBytesRead);
288  if (Val > std::numeric_limits<T>::max() || (Data + NumBytesRead > End)) {
289  return std::error_code();
290  }
291  Data += NumBytesRead;
292  return ErrorOr<T>(static_cast<T>(Val));
293 }
294 
295 template <typename T> ErrorOr<T> MCPseudoProbeDecoder::readSignedNumber() {
296  unsigned NumBytesRead = 0;
297  int64_t Val = decodeSLEB128(Data, &NumBytesRead);
298  if (Val > std::numeric_limits<T>::max() || (Data + NumBytesRead > End)) {
299  return std::error_code();
300  }
301  Data += NumBytesRead;
302  return ErrorOr<T>(static_cast<T>(Val));
303 }
304 
305 ErrorOr<StringRef> MCPseudoProbeDecoder::readString(uint32_t Size) {
306  StringRef Str(reinterpret_cast<const char *>(Data), Size);
307  if (Data + Size > End) {
308  return std::error_code();
309  }
310  Data += Size;
311  return ErrorOr<StringRef>(Str);
312 }
313 
315  std::size_t Size) {
316  // The pseudo_probe_desc section has a format like:
317  // .section .pseudo_probe_desc,"",@progbits
318  // .quad -5182264717993193164 // GUID
319  // .quad 4294967295 // Hash
320  // .uleb 3 // Name size
321  // .ascii "foo" // Name
322  // .quad -2624081020897602054
323  // .quad 174696971957
324  // .uleb 34
325  // .ascii "main"
326 
327  Data = Start;
328  End = Data + Size;
329 
330  while (Data < End) {
331  auto ErrorOrGUID = readUnencodedNumber<uint64_t>();
332  if (!ErrorOrGUID)
333  return false;
334 
335  auto ErrorOrHash = readUnencodedNumber<uint64_t>();
336  if (!ErrorOrHash)
337  return false;
338 
339  auto ErrorOrNameSize = readUnsignedNumber<uint32_t>();
340  if (!ErrorOrNameSize)
341  return false;
342  uint32_t NameSize = std::move(*ErrorOrNameSize);
343 
344  auto ErrorOrName = readString(NameSize);
345  if (!ErrorOrName)
346  return false;
347 
348  uint64_t GUID = std::move(*ErrorOrGUID);
349  uint64_t Hash = std::move(*ErrorOrHash);
350  StringRef Name = std::move(*ErrorOrName);
351 
352  // Initialize PseudoProbeFuncDesc and populate it into GUID2FuncDescMap
353  GUID2FuncDescMap.emplace(GUID, MCPseudoProbeFuncDesc(GUID, Hash, Name));
354  }
355  assert(Data == End && "Have unprocessed data in pseudo_probe_desc section");
356  return true;
357 }
358 
360  std::size_t Size) {
361  // The pseudo_probe section encodes an inline forest and each tree has a
362  // format like:
363  // FUNCTION BODY (one for each uninlined function present in the text
364  // section)
365  // GUID (uint64)
366  // GUID of the function
367  // NPROBES (ULEB128)
368  // Number of probes originating from this function.
369  // NUM_INLINED_FUNCTIONS (ULEB128)
370  // Number of callees inlined into this function, aka number of
371  // first-level inlinees
372  // PROBE RECORDS
373  // A list of NPROBES entries. Each entry contains:
374  // INDEX (ULEB128)
375  // TYPE (uint4)
376  // 0 - block probe, 1 - indirect call, 2 - direct call
377  // ATTRIBUTE (uint3)
378  // 1 - tail call, 2 - dangling
379  // ADDRESS_TYPE (uint1)
380  // 0 - code address, 1 - address delta
381  // CODE_ADDRESS (uint64 or ULEB128)
382  // code address or address delta, depending on Flag
383  // INLINED FUNCTION RECORDS
384  // A list of NUM_INLINED_FUNCTIONS entries describing each of the
385  // inlined callees. Each record contains:
386  // INLINE SITE
387  // Index of the callsite probe (ULEB128)
388  // FUNCTION BODY
389  // A FUNCTION BODY entry describing the inlined function.
390 
391  Data = Start;
392  End = Data + Size;
393 
394  MCDecodedPseudoProbeInlineTree *Root = &DummyInlineRoot;
395  MCDecodedPseudoProbeInlineTree *Cur = &DummyInlineRoot;
396  uint64_t LastAddr = 0;
397  uint32_t Index = 0;
398  // A DFS-based decoding
399  while (Data < End) {
400  if (Root == Cur) {
401  // Use a sequential id for top level inliner.
402  Index = Root->getChildren().size();
403  } else {
404  // Read inline site for inlinees
405  auto ErrorOrIndex = readUnsignedNumber<uint32_t>();
406  if (!ErrorOrIndex)
407  return false;
408  Index = std::move(*ErrorOrIndex);
409  }
410  // Switch/add to a new tree node(inlinee)
411  Cur = Cur->getOrAddNode(std::make_tuple(Cur->Guid, Index));
412  // Read guid
413  auto ErrorOrCurGuid = readUnencodedNumber<uint64_t>();
414  if (!ErrorOrCurGuid)
415  return false;
416  Cur->Guid = std::move(*ErrorOrCurGuid);
417  // Read number of probes in the current node.
418  auto ErrorOrNodeCount = readUnsignedNumber<uint32_t>();
419  if (!ErrorOrNodeCount)
420  return false;
421  uint32_t NodeCount = std::move(*ErrorOrNodeCount);
422  // Read number of direct inlinees
423  auto ErrorOrCurChildrenToProcess = readUnsignedNumber<uint32_t>();
424  if (!ErrorOrCurChildrenToProcess)
425  return false;
426  Cur->ChildrenToProcess = std::move(*ErrorOrCurChildrenToProcess);
427  // Read all probes in this node
428  for (std::size_t I = 0; I < NodeCount; I++) {
429  // Read index
430  auto ErrorOrIndex = readUnsignedNumber<uint32_t>();
431  if (!ErrorOrIndex)
432  return false;
433  uint32_t Index = std::move(*ErrorOrIndex);
434  // Read type | flag.
435  auto ErrorOrValue = readUnencodedNumber<uint8_t>();
436  if (!ErrorOrValue)
437  return false;
438  uint8_t Value = std::move(*ErrorOrValue);
439  uint8_t Kind = Value & 0xf;
440  uint8_t Attr = (Value & 0x70) >> 4;
441  // Read address
442  uint64_t Addr = 0;
443  if (Value & 0x80) {
444  auto ErrorOrOffset = readSignedNumber<int64_t>();
445  if (!ErrorOrOffset)
446  return false;
447  int64_t Offset = std::move(*ErrorOrOffset);
448  Addr = LastAddr + Offset;
449  } else {
450  auto ErrorOrAddr = readUnencodedNumber<int64_t>();
451  if (!ErrorOrAddr)
452  return false;
453  Addr = std::move(*ErrorOrAddr);
454  }
455  // Populate Address2ProbesMap
456  auto &Probes = Address2ProbesMap[Addr];
457  Probes.emplace_back(Addr, Cur->Guid, Index, PseudoProbeType(Kind), Attr,
458  Cur);
459  Cur->addProbes(&Probes.back());
460  LastAddr = Addr;
461  }
462 
463  // Look for the parent for the next node by subtracting the current
464  // node count from tree counts along the parent chain. The first node
465  // in the chain that has a non-zero tree count is the target.
466  while (Cur != Root) {
467  if (Cur->ChildrenToProcess == 0) {
468  Cur = static_cast<MCDecodedPseudoProbeInlineTree *>(Cur->Parent);
469  if (Cur != Root) {
470  assert(Cur->ChildrenToProcess > 0 &&
471  "Should have some unprocessed nodes");
472  Cur->ChildrenToProcess -= 1;
473  }
474  } else {
475  break;
476  }
477  }
478  }
479 
480  assert(Data == End && "Have unprocessed data in pseudo_probe section");
481  assert(Cur == Root &&
482  " Cur should point to root when the forest is fully built up");
483  return true;
484 }
485 
487  OS << "Pseudo Probe Desc:\n";
488  // Make the output deterministic
489  std::map<uint64_t, MCPseudoProbeFuncDesc> OrderedMap(GUID2FuncDescMap.begin(),
490  GUID2FuncDescMap.end());
491  for (auto &I : OrderedMap) {
492  I.second.print(OS);
493  }
494 }
495 
497  uint64_t Address) {
498  auto It = Address2ProbesMap.find(Address);
499  if (It != Address2ProbesMap.end()) {
500  for (auto &Probe : It->second) {
501  OS << " [Probe]:\t";
502  Probe.print(OS, GUID2FuncDescMap, true);
503  }
504  }
505 }
506 
508  std::vector<uint64_t> Addresses;
509  for (auto Entry : Address2ProbesMap)
510  Addresses.push_back(Entry.first);
511  std::sort(Addresses.begin(), Addresses.end());
512  for (auto K : Addresses) {
513  OS << "Address:\t";
514  OS << K;
515  OS << "\n";
516  printProbeForAddress(OS, K);
517  }
518 }
519 
520 const MCDecodedPseudoProbe *
522  auto It = Address2ProbesMap.find(Address);
523  if (It == Address2ProbesMap.end())
524  return nullptr;
525  const auto &Probes = It->second;
526 
527  const MCDecodedPseudoProbe *CallProbe = nullptr;
528  for (const auto &Probe : Probes) {
529  if (Probe.isCall()) {
530  assert(!CallProbe &&
531  "There should be only one call probe corresponding to address "
532  "which is a callsite.");
533  CallProbe = &Probe;
534  }
535  }
536  return CallProbe;
537 }
538 
539 const MCPseudoProbeFuncDesc *
541  auto It = GUID2FuncDescMap.find(GUID);
542  assert(It != GUID2FuncDescMap.end() && "Function descriptor doesn't exist");
543  return &It->second;
544 }
545 
547  const MCDecodedPseudoProbe *Probe,
549  bool IncludeLeaf) const {
550  Probe->getInlineContext(InlineContextStack, GUID2FuncDescMap);
551  if (!IncludeLeaf)
552  return;
553  // Note that the context from probe doesn't include leaf frame,
554  // hence we need to retrieve and prepend leaf if requested.
555  const auto *FuncDesc = getFuncDescForGUID(Probe->getGuid());
556  InlineContextStack.emplace_back(
557  MCPseduoProbeFrameLocation(FuncDesc->FuncName, Probe->getIndex()));
558 }
559 
561  const MCDecodedPseudoProbe *Probe) const {
562  MCDecodedPseudoProbeInlineTree *InlinerNode = Probe->getInlineTreeNode();
563  if (!InlinerNode->hasInlineSite())
564  return nullptr;
565  return getFuncDescForGUID(std::get<0>(InlinerNode->ISite));
566 }
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::GUIDProbeFunctionMap
std::unordered_map< uint64_t, MCPseudoProbeFuncDesc > GUIDProbeFunctionMap
Definition: MCPseudoProbe.h:101
llvm::MCContext::getObjectFileInfo
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:427
llvm::MCPseudoProbeDecoder::printProbeForAddress
void printProbeForAddress(raw_ostream &OS, uint64_t Address)
Definition: MCPseudoProbe.cpp:496
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::InlineSite
std::tuple< uint64_t, uint32_t > InlineSite
Definition: MCPseudoProbe.h:97
llvm::MCDecodedPseudoProbe::print
void print(raw_ostream &OS, const GUIDProbeFunctionMap &GUID2FuncMAP, bool ShowName) const
Definition: MCPseudoProbe.cpp:257
T
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::MCStreamer::emitInt64
void emitInt64(uint64_t Value)
Definition: MCStreamer.h:708
llvm::StringRef::find
LLVM_NODISCARD size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Definition: StringRef.h:315
llvm::MCStreamer::emitInt8
void emitInt8(uint64_t Value)
Definition: MCStreamer.h:705
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::MCPseudoProbeSection::emit
void emit(MCObjectStreamer *MCOS)
Definition: MCPseudoProbe.cpp:176
llvm::MCPseudoProbe
Instances of this class represent a pseudo probe instance for a pseudo probe table entry,...
Definition: MCPseudoProbe.h:155
llvm::COFF::NameSize
@ NameSize
Definition: COFF.h:58
MCObjectFileInfo.h
llvm::MCPseudoProbeInlineTree::addPseudoProbe
void addPseudoProbe(const MCPseudoProbe &Probe, const MCPseudoProbeInlineStack &InlineStack)
Definition: MCPseudoProbe.cpp:78
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::reverse
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
Definition: STLExtras.h:333
MCPseudoProbe.h
llvm::MCAsmInfo::getCodePointerSize
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition: MCAsmInfo.h:536
llvm::MCObjectFileInfo::getPseudoProbeSection
MCSection * getPseudoProbeSection(const MCSection *TextSec) const
Definition: MCObjectFileInfo.cpp:1091
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::PseudoProbeType
PseudoProbeType
Definition: PseudoProbe.h:28
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
llvm::MCPseudoProbeFuncDesc
Definition: MCPseudoProbe.h:82
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
MCObjectStreamer.h
llvm::MCPseudoProbeTable::getProbeSections
MCPseudoProbeSection & getProbeSections()
Definition: MCPseudoProbe.h:327
llvm::decodeULEB128
uint64_t decodeULEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a ULEB128 value.
Definition: LEB128.h:128
llvm::MCPseudoProbeFuncDesc::print
void print(raw_ostream &OS)
Definition: MCPseudoProbe.cpp:218
llvm::MCDecodedPseudoProbeInlineTree::ISite
InlineSite ISite
Definition: MCPseudoProbe.h:275
llvm::MCDecodedPseudoProbe::getInlineTreeNode
MCDecodedPseudoProbeInlineTree * getInlineTreeNode() const
Definition: MCPseudoProbe.h:188
MCContext.h
llvm::MCContext::getMCPseudoProbeTable
MCPseudoProbeTable & getMCPseudoProbeTable()
Definition: MCContext.h:833
llvm::MCStreamer::emitSymbolValue
void emitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
Definition: MCStreamer.cpp:181
llvm::MCObjectStreamer
Streaming object file generation interface.
Definition: MCObjectStreamer.h:36
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:146
llvm::MCPseudoProbeInlineTree::emit
void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *&LastProbe)
Definition: MCPseudoProbe.cpp:121
llvm::MCPseudoProbeDecoder::getInlineContextForProbe
void getInlineContextForProbe(const MCDecodedPseudoProbe *Probe, SmallVectorImpl< MCPseduoProbeFrameLocation > &InlineContextStack, bool IncludeLeaf) const
Definition: MCPseudoProbe.cpp:546
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::StringRef::str
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:245
llvm::MCPseudoProbeDecoder::buildGUID2FuncDescMap
bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size)
Definition: MCPseudoProbe.cpp:314
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::MCPseudoProbeInlineTreeBase::getOrAddNode
DerivedProbeInlineTreeType * getOrAddNode(const InlineSite &Site)
Definition: MCPseudoProbe.h:241
llvm::MCDecodedPseudoProbeInlineTree::ChildrenToProcess
uint32_t ChildrenToProcess
Definition: MCPseudoProbe.h:277
getProbeFNameForGUID
static StringRef getProbeFNameForGUID(const GUIDProbeFunctionMap &GUID2FuncMAP, uint64_t GUID)
Definition: MCPseudoProbe.cpp:210
buildSymbolDiff
static const MCExpr * buildSymbolDiff(MCObjectStreamer *MCOS, const MCSymbol *A, const MCSymbol *B)
Definition: MCPseudoProbe.cpp:30
llvm::MCPseudoProbeInlineTreeBase::getChildren
InlinedProbeTreeMap & getChildren()
Definition: MCPseudoProbe.h:235
llvm::MCSymbolRefExpr::VariantKind
VariantKind
Definition: MCExpr.h:194
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
uint64_t
llvm::MCPseudoProbe::emit
void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *LastProbe) const
Definition: MCPseudoProbe.cpp:41
llvm::MCPseudoProbeDecoder::buildAddress2ProbeMap
bool buildAddress2ProbeMap(const uint8_t *Start, std::size_t Size)
Definition: MCPseudoProbe.cpp:359
llvm::MCContext::getAsmInfo
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:423
llvm::MCPseudoProbeAddrFragment
Definition: MCFragment.h:616
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
LEB128.h
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
I
#define I(x, y, z)
Definition: MD5.cpp:59
Attributes
AMDGPU Kernel Attributes
Definition: AMDGPULowerKernelAttributes.cpp:254
llvm::MCBinaryExpr::create
static const MCBinaryExpr * create(Opcode Op, const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition: MCExpr.cpp:183
llvm::HighlightColor::Address
@ Address
llvm::MCObjectStreamer::insert
void insert(MCFragment *F)
Definition: MCObjectStreamer.h:78
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MCPseudoProbe::getLabel
MCSymbol * getLabel() const
Definition: MCPseudoProbe.h:167
llvm::MCPseudoProbeInlineTreeBase::Parent
MCPseudoProbeInlineTreeBase< ProbeType, DerivedProbeInlineTreeType > * Parent
Definition: MCPseudoProbe.h:240
llvm::MCDecodedPseudoProbe::getInlineContextStr
std::string getInlineContextStr(const GUIDProbeFunctionMap &GUID2FuncMAP) const
Definition: MCPseudoProbe.cpp:241
MCAsmInfo.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MCPseudoProbeDecoder::printGUID2FuncDescMap
void printGUID2FuncDescMap(raw_ostream &OS)
Definition: MCPseudoProbe.cpp:486
PseudoProbeTypeStr
static const char * PseudoProbeTypeStr[3]
Definition: MCPseudoProbe.cpp:254
uint32_t
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::MCPseudoProbeInlineTreeBase::Guid
uint64_t Guid
Definition: MCPseudoProbe.h:231
llvm::MCPseudoProbeBase::getGuid
uint64_t getGuid() const
Definition: MCPseudoProbe.h:126
llvm::MCPseudoProbeInlineTreeBase::addProbes
void addProbes(ProbeType Probe)
Definition: MCPseudoProbe.h:238
llvm::MCPseudoProbeTable::DdgPrintIndent
static int DdgPrintIndent
Definition: MCPseudoProbe.h:330
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::MCStreamer::emitSLEB128IntValue
void emitSLEB128IntValue(int64_t Value)
Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integ...
Definition: MCStreamer.cpp:170
llvm::MCPseudoProbeBase::getIndex
uint64_t getIndex() const
Definition: MCPseudoProbe.h:128
llvm::MCBinaryExpr::Sub
@ Sub
Subtraction.
Definition: MCExpr.h:505
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1492
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:385
llvm::MCDecodedPseudoProbeInlineTree::hasInlineSite
bool hasInlineSite() const
Definition: MCPseudoProbe.h:283
llvm::MCPseudoProbeDecoder::getCallProbeForAddr
const MCDecodedPseudoProbe * getCallProbeForAddr(uint64_t Address) const
Definition: MCPseudoProbe.cpp:521
llvm::MCPseudoProbeFlag::AddressDelta
@ AddressDelta
llvm::MCPseudoProbeDecoder::printProbesForAllAddresses
void printProbesForAllAddresses(raw_ostream &OS)
Definition: MCPseudoProbe.cpp:507
llvm::decodeSLEB128
int64_t decodeSLEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a SLEB128 value.
Definition: LEB128.h:161
llvm::MCPseudoProbeDecoder::getFuncDescForGUID
const MCPseudoProbeFuncDesc * getFuncDescForGUID(uint64_t GUID) const
Definition: MCPseudoProbe.cpp:540
llvm::MCStreamer::emitULEB128IntValue
void emitULEB128IntValue(uint64_t Value, unsigned PadTo=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
Definition: MCStreamer.cpp:161
llvm::MCStreamer::getContext
MCContext & getContext() const
Definition: MCStreamer.h:280
llvm::MCDecodedPseudoProbeInlineTree
Definition: MCPseudoProbe.h:271
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:497
MCStreamer.h
llvm::ErrorOr
Represents either an error or a value T.
Definition: ErrorOr.h:56
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:340
support
Reimplement select in terms of SEL *We would really like to support but we need to prove that the add doesn t need to overflow between the two bit chunks *Implement pre post increment support(e.g. PR935) *Implement smarter const ant generation for binops with large immediates. A few ARMv6T2 ops should be pattern matched
Definition: README.txt:10
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::MCDecodedPseudoProbe
Definition: MCPseudoProbe.h:174
llvm::MCDecodedPseudoProbe::getInlineContext
void getInlineContext(SmallVectorImpl< MCPseduoProbeFrameLocation > &ContextStack, const GUIDProbeFunctionMap &GUID2FuncMAP) const
Definition: MCPseudoProbe.cpp:223
llvm::MCSymbolRefExpr::VK_None
@ VK_None
Definition: MCExpr.h:195
llvm::MCPseduoProbeFrameLocation
std::pair< StringRef, uint32_t > MCPseduoProbeFrameLocation
Definition: MCPseudoProbe.h:172
llvm::MCPseudoProbeDecoder::getInlinerDescForProbe
const MCPseudoProbeFuncDesc * getInlinerDescForProbe(const MCDecodedPseudoProbe *Probe) const
Definition: MCPseudoProbe.cpp:560
readString
static StringRef readString(WasmObjectFile::ReadContext &Ctx)
Definition: WasmObjectFile.cpp:114
raw_ostream.h
Endian.h
llvm::MCStreamer::SwitchSection
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
Definition: MCStreamer.cpp:1212
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:908
llvm::MCObjectStreamer::getAssemblerPtr
MCAssembler * getAssemblerPtr() override
Definition: MCObjectStreamer.cpp:45
llvm::MCPseudoProbeTable::emit
static void emit(MCObjectStreamer *MCOS)
Definition: MCPseudoProbe.cpp:194