//===--------- LLJITRemovableCode.cpp -- LLJIT with Code Removal ----------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // In this example we will use an the resource management APIs to transfer // ownership of modules, remove modules from a JITDylib, and then a whole // JITDylib from the ExecutionSession. // //===----------------------------------------------------------------------===// #include "llvm/ExecutionEngine/Orc/LLJIT.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/Pass.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "../ExampleModules.h" usingnamespacellvm; usingnamespacellvm::orc; ExitOnError ExitOnErr; // Example IR modules. // // We will use a few modules containing no-op functions to demonstrate the code // removal APIs. const llvm::StringRef FooMod = …; const llvm::StringRef BarMod = …; const llvm::StringRef BazMod = …; int main(int argc, char *argv[]) { … }