Change syntax of const/high16 and const-wide/16

The literal is now specified as the post-shifted literal value, rather
than the pre-shifted 16 bits
This commit is contained in:
Ben Gruver 2013-04-15 21:54:16 -07:00
parent 38d0921bbb
commit feed0d1b84
2 changed files with 10 additions and 10 deletions

View File

@ -939,13 +939,13 @@ insn_format21c_type returns [int size]
insn_format21ih returns [int size]
: //e.g. const/high16 v1, 1234
INSTRUCTION_FORMAT21ih REGISTER COMMA integral_literal {$size = Format.Format21ih.size;}
-> ^(I_STATEMENT_FORMAT21ih[$start, "I_STATEMENT_FORMAT21ih"] INSTRUCTION_FORMAT21ih REGISTER integral_literal);
INSTRUCTION_FORMAT21ih REGISTER COMMA fixed_32bit_literal {$size = Format.Format21ih.size;}
-> ^(I_STATEMENT_FORMAT21ih[$start, "I_STATEMENT_FORMAT21ih"] INSTRUCTION_FORMAT21ih REGISTER fixed_32bit_literal);
insn_format21lh returns [int size]
: //e.g. const-wide/high16 v1, 1234
INSTRUCTION_FORMAT21lh REGISTER COMMA integral_literal {$size = Format.Format21lh.size;}
-> ^(I_STATEMENT_FORMAT21lh[$start, "I_STATEMENT_FORMAT21lh"] INSTRUCTION_FORMAT21lh REGISTER integral_literal);
INSTRUCTION_FORMAT21lh REGISTER COMMA fixed_32bit_literal {$size = Format.Format21lh.size;}
-> ^(I_STATEMENT_FORMAT21lh[$start, "I_STATEMENT_FORMAT21lh"] INSTRUCTION_FORMAT21lh REGISTER fixed_32bit_literal);
insn_format21s returns [int size]
: //e.g. const/16 v1, 1234

View File

@ -933,26 +933,26 @@ insn_format21c_type[int totalMethodRegisters, int methodParameterRegisters, List
insn_format21ih[int totalMethodRegisters, int methodParameterRegisters, List<Instruction> instructions] returns[int outRegisters]
: //e.g. const/high16 v1, 1234
^(I_STATEMENT_FORMAT21ih INSTRUCTION_FORMAT21ih REGISTER short_integral_literal)
^(I_STATEMENT_FORMAT21ih INSTRUCTION_FORMAT21ih REGISTER fixed_32bit_literal)
{
Opcode opcode = Opcode.getOpcodeByName($INSTRUCTION_FORMAT21ih.text);
short regA = parseRegister_byte($REGISTER.text, $totalMethodRegisters, $methodParameterRegisters);
short litB = $short_integral_literal.value;
int litB = $fixed_32bit_literal.value;
instructions.add(new ImmutableInstruction21ih(opcode, regA, litB<<16));
instructions.add(new ImmutableInstruction21ih(opcode, regA, litB));
};
insn_format21lh[int totalMethodRegisters, int methodParameterRegisters, List<Instruction> instructions] returns[int outRegisters]
: //e.g. const-wide/high16 v1, 1234
^(I_STATEMENT_FORMAT21lh INSTRUCTION_FORMAT21lh REGISTER short_integral_literal)
^(I_STATEMENT_FORMAT21lh INSTRUCTION_FORMAT21lh REGISTER fixed_64bit_literal)
{
Opcode opcode = Opcode.getOpcodeByName($INSTRUCTION_FORMAT21lh.text);
short regA = parseRegister_byte($REGISTER.text, $totalMethodRegisters, $methodParameterRegisters);
short litB = $short_integral_literal.value;
long litB = $fixed_64bit_literal.value;
instructions.add(new ImmutableInstruction21lh(opcode, regA, ((long)litB)<<48));
instructions.add(new ImmutableInstruction21lh(opcode, regA, litB));
};
insn_format21s[int totalMethodRegisters, int methodParameterRegisters, List<Instruction> instructions] returns[int outRegisters]