1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-06-30 22:07:11 -07:00

unfudge LI/LA a little

This commit is contained in:
Connor Olding 2015-11-22 00:24:28 -08:00
parent 5b35cc2155
commit 1b23db1a71

View File

@ -871,14 +871,16 @@ function Parser:instruction()
args.rt = self:register() args.rt = self:register()
self:optional_comma() self:optional_comma()
local im = self:const() local im = self:const()
local is_label = type(im[2]) ~= 'number' local is_label = im[1] == 'LABELSYM'
if h == 'LI' and is_label then if h == 'LI' and is_label then
self:error('use LA for addresses') self:error('use LA for addresses')
end end
if h == 'LA' and not is_label then if h == 'LA' and not is_label then
self:error('use LI for immediates') self:error('use LI for immediates')
end end
if h == 'LA' or im[2] >= 0x10000 then -- FIXME: defines shouldn't need a special case,
-- we should know their values already.
if h == 'LA' or im[1] == 'DEFSYM' or im[2] >= 0x10000 then
args.rs = args.rt args.rs = args.rt
args.immediate = {'UPPER', im} args.immediate = {'UPPER', im}
self:format_out(lui[3], lui[1], args, lui[4], lui[5]) self:format_out(lui[3], lui[1], args, lui[4], lui[5])