void compile_module_to_assembly(const Module &module, std::string filename) { if (filename.empty()) filename = module.name() + ".s"; llvm::LLVMContext context; std::unique_ptr<llvm::Module> llvm(compile_module_to_llvm_module(module, context)); compile_llvm_module_to_assembly(*llvm, filename); }
void compile_module_to_assembly(const Module &module, std::string filename) { if (filename.empty()) filename = module.name() + ".s"; llvm::LLVMContext context; llvm::Module *llvm = compile_module_to_llvm_module(module, context); compile_llvm_module_to_assembly(llvm, filename); delete llvm; }
void compile_module_to_native(const Module &module, std::string object_filename, std::string assembly_filename) { if (object_filename.empty()) object_filename = module.name() + ".o"; if (assembly_filename.empty()) assembly_filename = module.name() + ".s"; llvm::LLVMContext context; llvm::Module *llvm = compile_module_to_llvm_module(module, context); compile_llvm_module_to_object(llvm, object_filename); compile_llvm_module_to_assembly(llvm, assembly_filename); delete llvm; }
void compile_module_to_native(const Module &module, std::string object_filename, std::string assembly_filename) { if (object_filename.empty()) { if (module.target().os == Target::Windows) { object_filename = module.name() + ".obj"; } else { object_filename = module.name() + ".o"; } } if (assembly_filename.empty()) { assembly_filename = module.name() + ".s"; } llvm::LLVMContext context; std::unique_ptr<llvm::Module> llvm(compile_module_to_llvm_module(module, context)); compile_llvm_module_to_object(*llvm, object_filename); compile_llvm_module_to_assembly(*llvm, assembly_filename); }