1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-05-03 01:53:23 -07:00

unfudge LI/LA a little

This commit is contained in:
Connor Olding 2015-11-22 00:24:28 -08:00
parent 009d7080a4
commit d560f47be9

View File

@ -871,14 +871,16 @@ function Parser:instruction()
args.rt = self:register()
self:optional_comma()
local im = self:const()
local is_label = type(im[2]) ~= 'number'
local is_label = im[1] == 'LABELSYM'
if h == 'LI' and is_label then
self:error('use LA for addresses')
end
if h == 'LA' and not is_label then
self:error('use LI for immediates')
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.immediate = {'UPPER', im}
self:format_out(lui[3], lui[1], args, lui[4], lui[5])