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