MIPS: Add missing opcodes to the DynASM MIPS module plus minor fixes.

Allow single dot as macro name.
This commit is contained in:
Mike Pall 2012-01-23 19:06:58 +01:00
parent a72134e280
commit b9651b4ba2
2 changed files with 15 additions and 4 deletions

View File

@ -11,7 +11,7 @@ local _info = {
description = "DynASM MIPS module", description = "DynASM MIPS module",
version = "1.3.0", version = "1.3.0",
vernum = 10300, vernum = 10300,
release = "2011-12-16", release = "2012-01-23",
author = "Mike Pall", author = "Mike Pall",
license = "MIT", license = "MIT",
} }
@ -278,7 +278,9 @@ local map_op = {
-- Opcode SPECIAL. -- Opcode SPECIAL.
nop_0 = "00000000", nop_0 = "00000000",
sll_3 = "00000000DTA", sll_3 = "00000000DTA",
movf_2 = "00000001DS",
movf_3 = "00000001DSC", movf_3 = "00000001DSC",
movt_2 = "00010001DS",
movt_3 = "00010001DSC", movt_3 = "00010001DSC",
srl_3 = "00000002DTA", srl_3 = "00000002DTA",
rotr_3 = "00200002DTA", rotr_3 = "00200002DTA",
@ -309,10 +311,12 @@ local map_op = {
move_2 = "00000021DS", move_2 = "00000021DS",
addu_3 = "00000021DST", addu_3 = "00000021DST",
sub_3 = "00000022DST", sub_3 = "00000022DST",
negu_2 = "00000023DT",
subu_3 = "00000023DST", subu_3 = "00000023DST",
and_3 = "00000024DST", and_3 = "00000024DST",
or_3 = "00000025DST", or_3 = "00000025DST",
xor_3 = "00000026DST", xor_3 = "00000026DST",
not_2 = "00000027DS",
nor_3 = "00000027DST", nor_3 = "00000027DST",
slt_3 = "0000002aDST", slt_3 = "0000002aDST",
sltu_3 = "0000002bDST", sltu_3 = "0000002bDST",
@ -341,6 +345,7 @@ local map_op = {
teqi_2 = "040c0000SI", teqi_2 = "040c0000SI",
tnei_2 = "040e0000SI", tnei_2 = "040e0000SI",
bltzal_2 = "04100000SB", bltzal_2 = "04100000SB",
bal_1 = "04110000B",
bgezal_2 = "04110000SB", bgezal_2 = "04110000SB",
bltzall_2 = "04120000SB", bltzall_2 = "04120000SB",
bgezall_2 = "04130000SB", bgezall_2 = "04130000SB",
@ -659,8 +664,14 @@ end
local function parse_disp(disp) local function parse_disp(disp)
local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$") local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
if imm then if imm then
local r = parse_gpr(reg) local r = parse_gpr(reg)*2^21
return r*2^21 + parse_imm(imm, 16, 0, 0, true) local extname = match(imm, "^extern%s+(%S+)$")
if extname then
waction("REL_EXT", map_extern[extname], nil, 1)
return r
else
return r + parse_imm(imm, 16, 0, 0, true)
end
end end
local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$") local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
if reg and tailr ~= "" then if reg and tailr ~= "" then

View File

@ -390,7 +390,7 @@ map_coreop[".macro_*"] = function(mparams)
-- Split off and validate macro name. -- Split off and validate macro name.
local name = remove(mparams, 1) local name = remove(mparams, 1)
if not name then werror("missing macro name") end if not name then werror("missing macro name") end
if not (match(name, "^[%a_][%w_%.]*$") or match(name, "^%.[%w_%.]+$")) then if not (match(name, "^[%a_][%w_%.]*$") or match(name, "^%.[%w_%.]*$")) then
wfatal("bad macro name `"..name.."'") wfatal("bad macro name `"..name.."'")
end end
-- Validate macro parameter names. -- Validate macro parameter names.