Updated memory parsing

The values of base and index registers have been passed as 0, if only displacement is passed
the displacement is assumed to be alphanumeric (since label might be used)
This commit is contained in:
niravthakkar 2017-01-04 17:43:53 +05:30 committed by GitHub
parent 8b20a0eae2
commit 1fe2176241

View File

@ -325,10 +325,15 @@ local function split_memop(arg)
return d, 0, parse_reg(b) return d, 0, parse_reg(b)
end end
-- Assuming the two registers are passed as "(r1,r2)", and displacement(d) is not specified -- Assuming the two registers are passed as "(r1,r2)", and displacement(d) is not specified
local x, b = string.match(arg,"%(%s*("..reg..")%s*,%s*("..reg..")%s*%)$") local x, b = match(arg,"%(%s*("..reg..")%s*,%s*("..reg..")%s*%)$")
if b then if b then
return 0, parse_reg(x), parse_reg(b) return 0, parse_reg(x), parse_reg(b)
end end
-- Assuming that only displacement is passed, as either digit or label "45 or label1"
local d = match(arg,"[%w_]+")
if d then
return d, 0, 0
end
local reg, tailr = match(arg, "^([%w_:]+)%s*(.*)$") local reg, tailr = match(arg, "^([%w_:]+)%s*(.*)$")
if reg then if reg then
local r, tp = parse_reg(reg) local r, tp = parse_reg(reg)