You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
4e27ff2 added code for annotating SIL code with TFPartition markings.
One follow-up suggestion from clattner is to use sil printer callback before printing each instruction (SILPrinter.cpp:634):
for (const SILInstruction &I : *BB) {
Ctx.printInstructionCallBack(&I);
if (SILPrintGenericSpecializationInfo) {
if (auto AI = ApplySite::isa(const_cast<SILInstruction *>(&I)))
if (AI.getSpecializationInfo() && AI.getCalleeFunction())
printGenericSpecializationInfo(
PrintState.OS, "call-site", AI.getCalleeFunction()->getName(),
AI.getSpecializationInfo(), AI.getSubstitutions());
}
print(&I);
}
So we can derive a struct from SILPrintContext, and implement [move] kind of annotations by overriding Ctx.printInstructionCallBack. This way we hopefully just need to call “print” on the function with the right printer context defined.
Example code:
/// A print context which records the line numbers where instructions are/// printed.structAnalysisPrintContext : publicSILPrintContext {
AnalysisPrintContext(llvm::raw_ostream &OS) : SILPrintContext(OS) {}
~AnalysisPrintContext() override {}
voidprintInstructionCallBack(const SILInstruction *I) override {
OutStream << "XXXX ";
I->print(OutStream);
}
};
Call site:
if (auto *outs = getTFDumpIntermediateStream()) {
AnalysisPrintContext ctx(*outs);
fn.print(ctx);
}
One challenge is that in addition to annotating instructions, we also want to annotate BB args (code here). So the current callback mechanism on inst level is not sufficient. One option is to extend the SILPrinter callback infra to support annotating BB args.
The text was updated successfully, but these errors were encountered:
4e27ff2 added code for annotating SIL code with TFPartition markings.
One follow-up suggestion from clattner is to use sil printer callback before printing each instruction (SILPrinter.cpp:634):
So we can derive a struct from SILPrintContext, and implement [move] kind of annotations by overriding Ctx.printInstructionCallBack. This way we hopefully just need to call “print” on the function with the right printer context defined.
Example code:
Call site:
One challenge is that in addition to annotating instructions, we also want to annotate BB args (code here). So the current callback mechanism on inst level is not sufficient. One option is to extend the SILPrinter callback infra to support annotating BB args.
The text was updated successfully, but these errors were encountered: