//===- OrcV2CBindingsDumpObjects.c - Dump JIT'd objects to disk via C API -===// // // 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 // //===----------------------------------------------------------------------===// // // To run the demo build 'OrcV2CBindingsDumpObjects', then run the built // program. It will execute as for OrcV2CBindingsBasicUsage, but will write // a single JIT'd object out to the working directory. // // Try experimenting with the DumpDir and IdentifierOverride arguments to // LLVMOrcCreateDumpObjects. // //===----------------------------------------------------------------------===// #include "llvm-c/Core.h" #include "llvm-c/Error.h" #include "llvm-c/LLJIT.h" #include "llvm-c/Support.h" #include "llvm-c/Target.h" #include "llvm-c/Transforms/PassBuilder.h" #include <stdio.h> int handleError(LLVMErrorRef Err) { … } LLVMOrcThreadSafeModuleRef createDemoModule(void) { … } LLVMErrorRef myModuleTransform(void *Ctx, LLVMModuleRef Mod) { … } LLVMErrorRef transform(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut, LLVMOrcMaterializationResponsibilityRef MR) { … } int main(int argc, const char *argv[]) { … }