Ejemplo n.º 1
0
void compile_module_to_object(const Module &module, std::string filename) {
    if (filename.empty()) 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;
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
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);
}
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
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);
}