move some files around

This commit is contained in:
Andrew Kelley 2020-05-17 12:08:47 -04:00
parent e198eec76a
commit 88c8ff6e37
4 changed files with 21 additions and 8 deletions

View File

@ -1,2 +0,0 @@
pub const x86_64 = @import("backend/x86_64.zig");
pub const x86 = @import("backend/x86.zig");

View File

@ -11,8 +11,6 @@ const ErrorMsg = Module.ErrorMsg;
const Target = std.Target;
const Allocator = mem.Allocator;
const Backend = @import("backend.zig");
pub const Result = union(enum) {
/// The `code` parameter passed to `generateSymbol` has the value appended.
appended: void,
@ -194,14 +192,28 @@ const Function = struct {
},
else => return self.fail(src, "TODO implement @breakpoint() for {}", .{self.target.cpu.arch}),
}
return .unreach;
return .none;
}
fn genCall(self: *Function, inst: *ir.Inst.Call) !MCValue {
if (inst.args.func.cast(ir.Inst.Constant)) |func_inst| {
if (inst.args.args.len != 0) {
return self.fail(inst.base.src, "TODO implement call with more than 0 parameters", .{});
}
if (func_inst.val.cast(Value.Payload.Function)) |func_val| {
const func = func_val.func;
return self.fail(inst.base.src, "TODO implement calling function", .{});
} else {
return self.fail(inst.base.src, "TODO implement calling weird function values", .{});
}
} else {
return self.fail(inst.base.src, "TODO implement calling runtime known function pointer", .{});
}
switch (self.target.cpu.arch) {
else => return self.fail(inst.base.src, "TODO implement call for {}", .{self.target.cpu.arch}),
}
return .unreach;
}
fn genRet(self: *Function, inst: *ir.Inst.Ret) !MCValue {
@ -589,10 +601,13 @@ const Function = struct {
}
};
const x86_64 = @import("codegen/x86_64.zig");
const x86 = @import("codegen/x86.zig");
fn Reg(comptime arch: Target.Cpu.Arch) type {
return switch (arch) {
.i386 => Backend.x86.Register,
.x86_64 => Backend.x86_64.Register,
.i386 => x86.Register,
.x86_64 => x86_64.Register,
else => @compileError("TODO add more register enums"),
};
}