Esempio n. 1
0
void compile_module_to_llvm_assembly(const Module &module, std::string filename)  {
    if (filename.empty()) filename = module.name() + ".ll";

    llvm::LLVMContext context;
    std::unique_ptr<llvm::Module> llvm(compile_module_to_llvm_module(module, context));
    compile_llvm_module_to_llvm_assembly(*llvm, filename);
}
Esempio n. 2
0
void compile_module_to_llvm_assembly(const Module &module, std::string filename)  {
    if (filename.empty()) filename = module.name() + ".ll";

    llvm::LLVMContext context;
    llvm::Module *llvm = compile_module_to_llvm_module(module, context);
    compile_llvm_module_to_llvm_assembly(llvm, filename);
    delete llvm;
}
Esempio n. 3
0
void compile_module_to_llvm(const Module &module,
                 std::string bitcode_filename,
                 std::string llvm_assembly_filename)  {
    if (bitcode_filename.empty()) bitcode_filename = module.name() + ".bc";
    if (llvm_assembly_filename.empty()) llvm_assembly_filename = module.name() + ".ll";

    llvm::LLVMContext context;
    std::unique_ptr<llvm::Module> llvm(compile_module_to_llvm_module(module, context));
    compile_llvm_module_to_llvm_bitcode(*llvm, bitcode_filename);
    compile_llvm_module_to_llvm_assembly(*llvm, llvm_assembly_filename);
}
Esempio n. 4
0
void compile_module_to_llvm(const Module &module,
                 std::string bitcode_filename,
                 std::string llvm_assembly_filename)  {
    if (bitcode_filename.empty()) bitcode_filename = module.name() + ".bc";
    if (llvm_assembly_filename.empty()) llvm_assembly_filename = module.name() + ".ll";

    llvm::LLVMContext context;
    llvm::Module *llvm = compile_module_to_llvm_module(module, context);
    compile_llvm_module_to_llvm_bitcode(llvm, bitcode_filename);
    compile_llvm_module_to_llvm_assembly(llvm, llvm_assembly_filename);
    delete llvm;
}
Esempio n. 5
0
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;
}
Esempio n. 6
0
void compile_module_to_object(const Module &module, std::string filename) {
    if (filename.empty()) {
        if (module.target().os == Target::Windows) {
            filename = module.name() + ".obj";
        } else {
            filename = module.name() + ".o";
        }
    }

    llvm::LLVMContext context;
    std::unique_ptr<llvm::Module> llvm(compile_module_to_llvm_module(module, context));
    compile_llvm_module_to_object(*llvm, filename);
}
Esempio n. 7
0
void compile_module_to_object(const Module &module, std::string filename) {
    if (filename.empty()) {
        if (module.target().os == Target::Windows) {
            filename = module.name() + ".obj";
        } else {
            filename = module.name() + ".o";
        }
    }

    llvm::LLVMContext context;
    llvm::Module *llvm = compile_module_to_llvm_module(module, context);
    compile_llvm_module_to_object(llvm, filename);
    delete llvm;
}
Esempio n. 8
0
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);
}