[PATCH] D44965: [llvm][Instrumentation/MC] Add Call Graph Profile pass and object file emission.

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 26 15:42:03 PDT 2018


espindola added a comment.

The part MC and Object part of this patch LGTM.

The IR level probably needs someone more familiar with metadata as a reviewer.

If you commit the MC and Object parts this should be sufficient to unblock the lld part, right?



================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:133
+
+  for (const auto &MFE : ModuleFlags) {
+    StringRef Key = MFE.Key->getString();
----------------
use an explicit type


================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:144
 
-  auto *S = C.getELFSection(Section, ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
-  Streamer.SwitchSection(S);
-  Streamer.EmitLabel(C.getOrCreateSymbol(StringRef("OBJC_IMAGE_INFO")));
-  Streamer.EmitIntValue(Version, 4);
-  Streamer.EmitIntValue(Flags, 4);
-  Streamer.AddBlankLine();
+  for (const auto &Edge : CFGProfile->operands()) {
+    MDNode *E = cast<MDNode>(Edge);
----------------
Explicit type


================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:147
+    const MCSymbol *From = Streamer.getContext().getOrCreateSymbol(
+        cast<MDString>(E->getOperand(0))->getString());
+    const MCSymbol *To = Streamer.getContext().getOrCreateSymbol(
----------------
Should the metadata be referring to symbols by name?


================
Comment at: tools/llvm-readobj/ELFDumper.cpp:751
+  StringRef StrTable = unwrapOrError(Obj->getStringTableForSymtab(*DotSymtabSec));
+  Elf_Sym_Range Syms = unwrapOrError(Obj->symbols(DotSymtabSec));
+  if (Index >= Syms.size())
----------------
We should probably have these values cached in the dumper. It is OK for that to be a followup.


https://reviews.llvm.org/D44965





More information about the llvm-commits mailing list