Bolt mcg into the PowerPC backend. It doesn't build yet, but it is generating
*some* code.
This commit is contained in:
parent
d539389e81
commit
5f0164db62
|
@ -33,7 +33,6 @@ installable {
|
|||
"util/misc+pkg",
|
||||
"util/opt+pkg",
|
||||
"examples+pkg",
|
||||
"mach/proto/mcg+pkg",
|
||||
plat_packages
|
||||
}
|
||||
}
|
||||
|
|
|
@ -453,7 +453,7 @@ loadtarget = function(targetname)
|
|||
target = targets[targetname]
|
||||
if not target then
|
||||
error(string.format("build file '%s' contains no target '%s'",
|
||||
filename, targetpart))
|
||||
filepart, targetpart))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -423,6 +423,10 @@ PATTERNS
|
|||
emit "subf %out, %out, %left"
|
||||
cost 12;
|
||||
|
||||
out:(int)reg = MUL4(left:(int)reg, right:(int)reg)
|
||||
emit "mullw %out, %left, %right"
|
||||
cost 4;
|
||||
|
||||
out:(int)reg = DIV4(left:(int)reg, right:(int)reg)
|
||||
emit "divw %out, %left, %right"
|
||||
cost 4;
|
|
@ -1,43 +1,51 @@
|
|||
include("util/mcgg/build.lua")
|
||||
|
||||
mcgg {
|
||||
name = "mcgg_c",
|
||||
srcs = { "./table" }
|
||||
}
|
||||
|
||||
cprogram {
|
||||
name = "mcg",
|
||||
srcs = {
|
||||
"./*.c",
|
||||
matching(filenamesof("+mcgg_c"), "%.c$"),
|
||||
definerule("build_mcg",
|
||||
{
|
||||
arch = { type="string" }
|
||||
},
|
||||
deps = {
|
||||
"+mcgg_c",
|
||||
"./*.h",
|
||||
"h+emheaders",
|
||||
"modules+headers",
|
||||
"modules/src/alloc+lib",
|
||||
"modules/src/data+lib",
|
||||
"modules/src/em_code+lib_k",
|
||||
"modules/src/em_data+lib",
|
||||
"modules/src/idf+lib",
|
||||
"modules/src/read_em+lib_ev",
|
||||
"modules/src/string+lib",
|
||||
"modules/src/system+lib",
|
||||
"util/mcgg+lib",
|
||||
},
|
||||
vars = {
|
||||
["+cflags"] = {
|
||||
"-Werror-implicit-function-declaration",
|
||||
function(e)
|
||||
-- Remember this is executed from the caller's directory; local
|
||||
-- target names will resolve there
|
||||
local headers = clibrary {
|
||||
name = e.name.."/headers",
|
||||
srcs = {},
|
||||
hdrs = {
|
||||
"mach/proto/mcg/*.h",
|
||||
"mach/"..e.arch.."/mcg/*.h",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Just for test purposes for now
|
||||
installable {
|
||||
name = "pkg",
|
||||
map = {
|
||||
["$(PLATDEP)/mcg"] = "+mcg"
|
||||
}
|
||||
}
|
||||
local tables = mcgg {
|
||||
name = e.name.."/tables",
|
||||
srcs = { "mach/"..e.arch.."/mcg/table" }
|
||||
}
|
||||
|
||||
return cprogram {
|
||||
name = e.name,
|
||||
srcs = {
|
||||
"mach/proto/mcg/*.c",
|
||||
"mach/"..e.arch.."/mcg/platform.c",
|
||||
matching(filenamesof(tables), "%.c$")
|
||||
},
|
||||
deps = {
|
||||
"h+emheaders",
|
||||
"modules+headers",
|
||||
"modules/src/alloc+lib",
|
||||
"modules/src/data+lib",
|
||||
"modules/src/em_code+lib_k",
|
||||
"modules/src/em_data+lib",
|
||||
"modules/src/flt_arith+lib",
|
||||
"modules/src/idf+lib",
|
||||
"modules/src/object+lib",
|
||||
"modules/src/read_em+lib_kv",
|
||||
"modules/src/string+lib",
|
||||
"modules/src/system+lib",
|
||||
"util/mcgg+lib",
|
||||
headers,
|
||||
tables, -- for .h file
|
||||
}
|
||||
}
|
||||
end
|
||||
)
|
||||
|
||||
|
|
|
@ -441,12 +441,13 @@ static void insn_ivalue(int opcode, arith value)
|
|||
case op_rmi: simple_alu2(opcode, value, IR_MOD); break;
|
||||
case op_sli: simple_alu2(opcode, value, IR_ASL); break;
|
||||
case op_sri: simple_alu2(opcode, value, IR_ASR); break;
|
||||
case op_slu: simple_alu2(opcode, value, IR_LSL); break;
|
||||
case op_sru: simple_alu2(opcode, value, IR_LSR); break;
|
||||
case op_ngi: simple_alu1(opcode, value, IR_NEG); break;
|
||||
|
||||
case op_adu: simple_alu2(opcode, value, IR_ADD); break;
|
||||
case op_sbu: simple_alu2(opcode, value, IR_SUB); break;
|
||||
case op_mlu: simple_alu2(opcode, value, IR_MUL); break;
|
||||
case op_slu: simple_alu2(opcode, value, IR_LSL); break;
|
||||
case op_sru: simple_alu2(opcode, value, IR_LSR); break;
|
||||
|
||||
case op_and: simple_alu2(opcode, value, IR_AND); break;
|
||||
case op_ior: simple_alu2(opcode, value, IR_OR); break;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
include("mach/proto/as/build.lua")
|
||||
include("mach/proto/ncg/build.lua")
|
||||
include("mach/proto/mcg/build.lua")
|
||||
include("mach/proto/top/build.lua")
|
||||
|
||||
definerule("ackfile",
|
||||
|
|
|
@ -5,8 +5,8 @@ build_as {
|
|||
arch = "powerpc",
|
||||
}
|
||||
|
||||
build_ncg {
|
||||
name = "ncg",
|
||||
build_mcg {
|
||||
name = "mcg",
|
||||
arch = "powerpc",
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ return installable {
|
|||
name = "tools",
|
||||
map = {
|
||||
["$(PLATDEP)/linuxppc/as"] = "+as",
|
||||
["$(PLATDEP)/linuxppc/ncg"] = "+ncg",
|
||||
["$(PLATDEP)/linuxppc/mcg"] = "+mcg",
|
||||
["$(PLATIND)/descr/linuxppc"] = "./descr",
|
||||
"util/opt+pkg",
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ var C_INCLUDES=-I{PLATFORMDIR}/include -I{EM}/share/ack/include/ansi
|
|||
name be
|
||||
from .m.g
|
||||
to .s
|
||||
program {EM}/lib/ack/{PLATFORM}/ncg
|
||||
program {EM}/lib/ack/{PLATFORM}/mcg
|
||||
mapflag -gdb GF=-gdb
|
||||
args {GF?} <
|
||||
stdout
|
||||
|
|
Loading…
Reference in a new issue