aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/ModuleUtils.cpp
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2024-05-14 18:01:23 -0700
committerGitHub <noreply@github.com>2024-05-14 18:01:23 -0700
commitdfdc3dcbe7f38bde64bc83a74b9c3451c50e1ad4 (patch)
treee6a4f32c36fff86a892b78e3f5d569c51ba15ae9 /llvm/lib/Transforms/Utils/ModuleUtils.cpp
parentc5cd049566a795ba5de88dfbb2eb563cad4a9d8a (diff)
downloadllvm-dfdc3dcbe7f38bde64bc83a74b9c3451c50e1ad4.zip
llvm-dfdc3dcbe7f38bde64bc83a74b9c3451c50e1ad4.tar.gz
llvm-dfdc3dcbe7f38bde64bc83a74b9c3451c50e1ad4.tar.bz2
[ctx_profile] Profile reader and writer (#91859)
Utility converting a profile coming from `compiler_rt` to bitstream, and a reader. `PGOCtxProfileWriter::write` would be used as the `Writer` parameter for `__llvm_ctx_profile_fetch` API. This is expected to happen in user code, for example in the RPC hanler tasked with collecting a profile, and would look like this: ``` // set up an output stream "Out", which could contain other stuff { // constructing the Writer will start the section, in Out, containing // the collected contextual profiles. PGOCtxProfWriter Writer(Out); __llvm_ctx_profile_fetch(&Writer, +[](void* W, const ContextNode &N) { reinterpret_cast<PGOCtxProfWriter*>(W)->write(N); }); // Writer going out of scope will finish up the section. } ``` The reader produces a data structure suitable for maintenance during IPO transformations.
Diffstat (limited to 'llvm/lib/Transforms/Utils/ModuleUtils.cpp')
0 files changed, 0 insertions, 0 deletions