1 #/bin/emblua LUAPREFIX=/*|
7 /*| function pred_ipairs(t, pred)
8 /*| return function(t,k)
13 /*| until not v or pred(k, v)
17 /*| function isa(v) return not v[N==32 and "x64" or "x32only"] end
18 /*| function isaN(k,v) return not v[N==32 and "x64" or "x32"] end
19 #include "test_asm_x86_%(N).h"
20 #include "jitcs_machine.h"
21 #include "jitcs_tmpalloc.h"
22 #include "jitcs_memmgr.h"
23 #include "jitcs_function.h"
24 #include "jitcs_int_virtualregister.h"
28 using namespace jitcs;
30 /*| local rdata= runfile("../src/data/x86_reglist.dat")
31 /*| local function hex2(n) return string.format("0x%02x", n) end
34 void TestAssemblerX86_%(N)::setupRegisterClassNames
35 (std::map<std::string, u32>& m) {
36 /*| for _,cl in pred_ipairs(rdata.refclasses,isaN) do
37 m["%(string.lower(cl.name))"] = x86_%(N)::RCL_%(cl.name);
39 /*| for _,cl in pred_ipairs(rdata.refclassaliases,isaN) do
40 m["%(string.lower(cl.name))"] = x86_%(N)::RCL_%(cl.name);
46 /*| for k,v in ipairs(rdata.classes) do
49 /*| local c2r, c2ra, n2r = {}, {}, {}
50 /*| for k,v in ipairs(rdata.registers) do
52 /*| local c = c2r[v.class] or {}
56 /*| for k,v2 in ipairs(rdata.registeraliases) do
57 /*| local v = n2r[v2.dest]
58 /*| local c = c2ra[v.class] or {}
63 void TestAssemblerX86_%(N)::setupFixedRegisterNames
64 (std::map<std::string, const VirtualRegister*>& m) {
65 /*| for l,cl in pred_ipairs(rdata.classes,isaN) do
66 /*| for k,v in pred_ipairs(c2r[cl.name],isaN) do
67 m["%(string.lower(v.name))"] = static_cast<const VirtualRegister*>(x86_%(N)::%(v.name));
69 /*| for k,v in pred_ipairs(c2ra[cl.name],isaN) do
70 m["%(string.lower(v.name))"] = static_cast<const VirtualRegister*>(x86_%(N)::%(v.name));