initialize all llvm features befbore emitting
This commit is contained in:
parent
469625d32a
commit
05c480c364
1 changed files with 19 additions and 5 deletions
|
@ -94,11 +94,11 @@ pub const Codegen = struct {
|
|||
return CompileError.LLVMError;
|
||||
}
|
||||
|
||||
//llvm.InitializeAllTargetInfos();
|
||||
//llvm.InitializeAllTargets();
|
||||
//llvm.InitializeAllTargetMCs();
|
||||
//llvm.InitializeAllAsmParsers();
|
||||
//llvm.InitializeAllAsmPrinters();
|
||||
llvm.LLVMInitializeAllTargetInfos();
|
||||
llvm.LLVMInitializeAllTargets();
|
||||
llvm.LLVMInitializeAllTargetMCs();
|
||||
llvm.LLVMInitializeAllAsmParsers();
|
||||
llvm.LLVMInitializeAllAsmPrinters();
|
||||
|
||||
var engine: llvm.LLVMExecutionEngineRef = undefined;
|
||||
if (llvm.LLVMCreateExecutionEngineForModule(&engine, mod, &err) != 0) {
|
||||
|
@ -117,6 +117,9 @@ pub const Codegen = struct {
|
|||
var outpath = try std.mem.dupe(self.allocator, u8, "output.o");
|
||||
var outpath_cstr = try std.cstr.addNullByte(self.allocator, outpath);
|
||||
|
||||
//var asmpath = try std.mem.dupe(self.allocator, u8, "output.S");
|
||||
//var asmpath_cstr = try std.cstr.addNullByte(self.allocator, asmpath);
|
||||
|
||||
var desc = llvm.LLVMGetTargetDescription(target);
|
||||
var features = llvm.LLVMGetTargetMachineFeatureString(machine);
|
||||
var triple = llvm.LLVMGetTargetMachineTriple(machine);
|
||||
|
@ -125,6 +128,17 @@ pub const Codegen = struct {
|
|||
std.debug.warn("triple: {}\n", sliceify(triple));
|
||||
std.debug.warn("features: {}\n", sliceify(features));
|
||||
|
||||
//if (llvm.LLVMTargetMachineEmitToFile(
|
||||
// machine,
|
||||
// mod,
|
||||
// asmpath_cstr.ptr,
|
||||
// llvm.LLVMCodeGenFileType.LLVMAssemblyFile,
|
||||
// &err,
|
||||
//) != 0) {
|
||||
// std.debug.warn("failed to emit to assembly file: {}\n", sliceify(err));
|
||||
// return CompileError.LLVMError;
|
||||
//}
|
||||
|
||||
if (llvm.LLVMTargetMachineEmitToFile(
|
||||
machine,
|
||||
mod,
|
||||
|
|
Loading…
Reference in a new issue