Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the usage of llvm::legacy::PassManager #6491

Merged
merged 2 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/CodeGen_PTX_Dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,16 @@ vector<char> CodeGen_PTX_Dev::compile_to_src() {
raw_svector_ostream ostream(outstr);
ostream.SetUnbuffered();

// NOTE: use of the "legacy" PassManager here is still required; it is deprecated
// for optimization, but is still the only complete API for codegen as of work-in-progress
// LLVM14. At the time of this comment (Dec 2021), there is no firm plan as to when codegen will
// be fully available in the new PassManager, so don't worry about this 'legacy'
// tag until there's any indication that the old APIs start breaking.
//
// See:
// https://lists.llvm.org/pipermail/llvm-dev/2021-April/150100.html
// https://releases.llvm.org/13.0.0/docs/ReleaseNotes.html#changes-to-the-llvm-ir
// https://groups.google.com/g/llvm-dev/c/HoS07gXx0p8
legacy::FunctionPassManager function_pass_manager(module.get());
legacy::PassManager module_pass_manager;

Expand Down
11 changes: 11 additions & 0 deletions src/LLVM_Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,17 @@ void emit_file(const llvm::Module &module_in, Internal::LLVMOStream &out,
}

// Build up all of the passes that we want to do to the module.

// NOTE: use of the "legacy" PassManager here is still required; it is deprecated
// for optimization, but is still the only complete API for codegen as of work-in-progress
// LLVM14. At the time of this comment (Dec 2021), there is no firm plan as to when codegen will
// be fully available in the new PassManager, so don't worry about this 'legacy'
// tag until there's any indication that the old APIs start breaking.
//
// See:
// https://lists.llvm.org/pipermail/llvm-dev/2021-April/150100.html
// https://releases.llvm.org/13.0.0/docs/ReleaseNotes.html#changes-to-the-llvm-ir
// https://groups.google.com/g/llvm-dev/c/HoS07gXx0p8
llvm::legacy::PassManager pass_manager;

pass_manager.add(new llvm::TargetLibraryInfoWrapperPass(llvm::Triple(module->getTargetTriple())));
Expand Down