From: David Given Date: Sat, 29 Oct 2016 21:37:11 +0000 (+0200) Subject: Get top working with the PowerPC; use it to eliminate useless branches and X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=8c3670483fc1f896aba79bb4573077f153862e16;p=ack.git Get top working with the PowerPC; use it to eliminate useless branches and moves. --- diff --git a/mach/powerpc/libem/build.lua b/mach/powerpc/libem/build.lua index 56278aa55..dd9ec7542 100644 --- a/mach/powerpc/libem/build.lua +++ b/mach/powerpc/libem/build.lua @@ -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 diff --git a/mach/powerpc/top/table b/mach/powerpc/top/table index e735afee6..acbe543a7 100644 --- a/mach/powerpc/top/table +++ b/mach/powerpc/top/table @@ -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 */ + %%; diff --git a/mach/proto/mcg/parse_em.c b/mach/proto/mcg/parse_em.c index 4644d3a09..b66b177c4 100644 --- a/mach/proto/mcg/parse_em.c +++ b/mach/proto/mcg/parse_em.c @@ -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) diff --git a/plat/linuxppc/build-tools.lua b/plat/linuxppc/build-tools.lua index 0157e31a4..ce1a163d8 100644 --- a/plat/linuxppc/build-tools.lua +++ b/plat/linuxppc/build-tools.lua @@ -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", } diff --git a/plat/linuxppc/descr b/plat/linuxppc/descr index 72958b212..79188640a 100644 --- a/plat/linuxppc/descr +++ b/plat/linuxppc/descr @@ -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