Add x86_push and x86_pop instructions.

This commit is contained in:
Tyler McMullen
2017-11-22 12:25:01 -08:00
committed by Jakob Stoklund Olesen
parent 04f6ccabe5
commit 8ed37e352e
6 changed files with 20 additions and 1 deletions

View File

@@ -32,6 +32,8 @@ Ternary = InstructionFormat(VALUE, VALUE, VALUE, typevar_operand=1)
# operands.
MultiAry = InstructionFormat(VARIABLE_ARGS)
NullAry = InstructionFormat()
InsertLane = InstructionFormat(VALUE, ('lane', uimm8), VALUE)
ExtractLane = InstructionFormat(VALUE, ('lane', uimm8))

View File

@@ -99,4 +99,17 @@ fmax = Instruction(
""",
ins=(x, y), outs=a)
WideInt = TypeVar(
'WideInt', 'An integer type with 16 to 64 bits',
ints=(16, 64))
x = Operand('x', WideInt)
push = Instruction(
'x86_push', "Pushes onto the stack.",
ins=x, can_store=True, other_side_effects=True)
pop = Instruction(
'x86_pop', "Pops from the stack.",
outs=x, can_load=True, other_side_effects=True)
GROUP.close()

View File

@@ -120,6 +120,7 @@ pub enum InstructionData {
},
Ternary { opcode: Opcode, args: [Value; 3] },
MultiAry { opcode: Opcode, args: ValueList },
NullAry { opcode: Opcode },
InsertLane {
opcode: Opcode,
lane: Uimm8,

View File

@@ -359,7 +359,8 @@ impl<'a> Verifier<'a> {
Store { .. } |
RegMove { .. } |
Trap { .. } |
CondTrap { .. } => {}
CondTrap { .. } |
NullAry { .. } => {}
}
Ok(())

View File

@@ -295,6 +295,7 @@ pub fn write_operands(
write!(w, " {}", DisplayValues(args.as_slice(pool)))
}
}
NullAry { .. } => write!(w, " "),
InsertLane { lane, args, .. } => write!(w, " {}, {}, {}", args[0], lane, args[1]),
ExtractLane { lane, arg, .. } => write!(w, " {}, {}", arg, lane),
IntCompare { cond, args, .. } => write!(w, " {} {}, {}", cond, args[0], args[1]),

View File

@@ -1955,6 +1955,7 @@ impl<'a> Parser<'a> {
args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists),
}
}
InstructionFormat::NullAry => InstructionData::NullAry { opcode },
InstructionFormat::Jump => {
// Parse the destination EBB number. Don't translate source to local numbers yet.
let ebb_num = self.match_ebb("expected jump destination EBB")?;