Get top working with the PowerPC; use it to eliminate useless branches and

moves.
This commit is contained in:
David Given 2016-10-29 23:37:11 +02:00
parent a8c4dac67c
commit 8c3670483f
5 changed files with 34 additions and 14 deletions

View file

@ -1,4 +1,9 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "headers_"..plat,
hdrs = { "./*.h" }
}
acklibrary {
name = "lib_"..plat,
srcs = {
@ -6,7 +11,8 @@ for _, plat in ipairs(vars.plats) do
},
vars = { plat = plat },
deps = {
"h+emheaders"
"h+emheaders",
"+headers_"..plat,
}
}
end

View file

@ -1,7 +1,8 @@
/* 68020 desciptor table for ACK target optimizer */
/* PowerPC desciptor table for ACK target optimizer */
MAXOP 3;
LABEL_STARTER '.';
%%;
@ -15,6 +16,14 @@ X, Y, Z { TRUE };
addi X, X, 0 -> ;
addis X, X, 0 -> ;
mr X, X -> ;
fmr X, X -> ;
or X, Y, Z : or. X, X, X -> or. X, Y, Z ;
b X : labdef X -> labdef X ;
/* IFFALSE=4, IFTRUE=12, ALWAYS=20 */
/* LT=0, GT=1, EQ=2, OV=3 */
%%;

View file

@ -51,12 +51,12 @@ static void unknown_type(const char* s)
static const char* ilabel_to_str(label l)
{
assert(current_proc != NULL);
return aprintf("__%s_I%d", current_proc->name, l);
return aprintf(".%s_I%d", current_proc->name, l);
}
static const char* dlabel_to_str(label l)
{
return aprintf("__D%d", l);
return aprintf(".D%d", l);
}
static void terminate_block(void)

View file

@ -15,12 +15,18 @@ build_ncg {
arch = "powerpc",
}
build_top {
name = "top",
arch = "powerpc",
}
return installable {
name = "tools",
map = {
["$(PLATDEP)/linuxppc/as"] = "+as",
["$(PLATDEP)/linuxppc/ncg"] = "+ncg",
["$(PLATDEP)/linuxppc/mcg"] = "+mcg",
["$(PLATDEP)/linuxppc/top"] = "+top",
["$(PLATIND)/descr/linuxppc"] = "./descr",
"util/opt+pkg",
}

View file

@ -40,16 +40,15 @@ name be
stdout
need .e
end
# FIXME(dtrg): not working yet
#name asopt
# from .s
# to .so
# program {EM}/lib/ack/{PLATFORM}/top
# args
# optimizer
# stdin
# stdout
#end
name asopt
from .s
to .so
program {EM}/lib/ack/{PLATFORM}/top
args
optimizer
stdin
stdout
end
name as
from .s.so
to .o