diff --git a/lib/cretonne/meta/base/formats.py b/lib/cretonne/meta/base/formats.py index 4e1ff3500a..1961d9d4a9 100644 --- a/lib/cretonne/meta/base/formats.py +++ b/lib/cretonne/meta/base/formats.py @@ -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)) diff --git a/lib/cretonne/meta/isa/intel/instructions.py b/lib/cretonne/meta/isa/intel/instructions.py index 27a0063557..3389f77708 100644 --- a/lib/cretonne/meta/isa/intel/instructions.py +++ b/lib/cretonne/meta/isa/intel/instructions.py @@ -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() diff --git a/lib/cretonne/src/ir/instructions.rs b/lib/cretonne/src/ir/instructions.rs index f110cd14db..c474258f37 100644 --- a/lib/cretonne/src/ir/instructions.rs +++ b/lib/cretonne/src/ir/instructions.rs @@ -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, diff --git a/lib/cretonne/src/verifier/mod.rs b/lib/cretonne/src/verifier/mod.rs index 2144264f40..6b67ed1bed 100644 --- a/lib/cretonne/src/verifier/mod.rs +++ b/lib/cretonne/src/verifier/mod.rs @@ -359,7 +359,8 @@ impl<'a> Verifier<'a> { Store { .. } | RegMove { .. } | Trap { .. } | - CondTrap { .. } => {} + CondTrap { .. } | + NullAry { .. } => {} } Ok(()) diff --git a/lib/cretonne/src/write.rs b/lib/cretonne/src/write.rs index 9de3e93d58..1604ca559a 100644 --- a/lib/cretonne/src/write.rs +++ b/lib/cretonne/src/write.rs @@ -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]), diff --git a/lib/reader/src/parser.rs b/lib/reader/src/parser.rs index d809cd192c..b96cba20b2 100644 --- a/lib/reader/src/parser.rs +++ b/lib/reader/src/parser.rs @@ -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")?;