mirror of
https://github.com/notwa/lips
synced 2024-05-07 11:53:23 -07:00
handle the alternative names as well
This commit is contained in:
parent
272ef0fbde
commit
81f5f317bf
|
@ -4,13 +4,6 @@ local unpack = rawget(_G, 'unpack') or table.unpack
|
||||||
local path = string.gsub(..., "[^.]+$", "")
|
local path = string.gsub(..., "[^.]+$", "")
|
||||||
local data = require(path.."data")
|
local data = require(path.."data")
|
||||||
|
|
||||||
local fpu_tob = {
|
|
||||||
LDC1=true,
|
|
||||||
LWC1=true,
|
|
||||||
SDC1=true,
|
|
||||||
SWC1=true,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function name_pop(name, character)
|
local function name_pop(name, character)
|
||||||
if name:sub(#name) == character then
|
if name:sub(#name) == character then
|
||||||
return name:sub(1, #name - 1), character
|
return name:sub(1, #name - 1), character
|
||||||
|
@ -56,6 +49,7 @@ end
|
||||||
local overrides = {}
|
local overrides = {}
|
||||||
-- note: "self" is an instance of Expander
|
-- note: "self" is an instance of Expander
|
||||||
|
|
||||||
|
local fpu_tob = {}
|
||||||
local function tob_override(self, name)
|
local function tob_override(self, name)
|
||||||
-- handle all the addressing modes for lw/sw-like instructions
|
-- handle all the addressing modes for lw/sw-like instructions
|
||||||
local dest = fpu_tob[name] and self:pop('FPU') or self:pop('CPU')
|
local dest = fpu_tob[name] and self:pop('FPU') or self:pop('CPU')
|
||||||
|
@ -101,7 +95,10 @@ local function tob_override(self, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs(data.instructions) do
|
for k, v in pairs(data.instructions) do
|
||||||
if v[2] == 'tob' or v[2] == 'Tob' then
|
if v[2] == 'tob' then
|
||||||
|
overrides[k] = tob_override
|
||||||
|
elseif v[2] == 'Tob' then
|
||||||
|
fpu_tob[k] = true
|
||||||
overrides[k] = tob_override
|
overrides[k] = tob_override
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user