Add (some) encodings for x86_push/pop instructions. Simple uses actually pass the legalizer now.
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
cdf70ccb77
commit
b8275f5713
@@ -227,6 +227,10 @@ enc_i32_i64(base.regfill, r.rfi32, 0x8b)
|
||||
enc_both(base.fill.b1, r.fiSib32, 0x8b)
|
||||
enc_both(base.regfill.b1, r.rfi32, 0x8b)
|
||||
|
||||
# Push and Pop
|
||||
I64.enc(x86.push.i64, *r.pushq(0x50))
|
||||
I64.enc(x86.pop.i64, *r.popq(0x58))
|
||||
|
||||
#
|
||||
# Float loads and stores.
|
||||
#
|
||||
|
||||
@@ -99,10 +99,9 @@ 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)
|
||||
|
||||
Int = TypeVar('Int', 'A scalar integer type', ints=True)
|
||||
x = Operand('x', Int)
|
||||
|
||||
push = Instruction(
|
||||
'x86_push', "Pushes onto the stack.",
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import absolute_import
|
||||
from cdsl.isa import EncRecipe
|
||||
from cdsl.predicates import IsSignedInt, IsEqual, Or
|
||||
from cdsl.registers import RegClass
|
||||
from base.formats import Unary, UnaryImm, Binary, BinaryImm, MultiAry
|
||||
from base.formats import Unary, UnaryImm, Binary, BinaryImm, MultiAry, NullAry
|
||||
from base.formats import Trap, Call, IndirectCall, Store, Load
|
||||
from base.formats import IntCompare, FloatCompare, IntCond, FloatCond
|
||||
from base.formats import Jump, Branch, BranchInt, BranchFloat
|
||||
@@ -472,6 +472,18 @@ puiq = TailRecipe(
|
||||
sink.put8(imm as u64);
|
||||
''')
|
||||
|
||||
pushq = TailRecipe(
|
||||
'pushq', Unary, size=0, ins=GPR, outs=(),
|
||||
emit='''
|
||||
PUT_OP(bits | (in_reg0 & 7), rex1(in_reg0), sink);
|
||||
''')
|
||||
|
||||
popq = TailRecipe(
|
||||
'popq', NullAry, size=0, ins=(), outs=GPR,
|
||||
emit='''
|
||||
PUT_OP(bits | (out_reg0 & 7), rex1(out_reg0), sink);
|
||||
''')
|
||||
|
||||
# XX+rd id with Abs4 function relocation.
|
||||
fnaddr4 = TailRecipe(
|
||||
'fnaddr4', FuncAddr, size=4, ins=(), outs=GPR,
|
||||
|
||||
@@ -82,6 +82,8 @@ fn legalize_entry_params(func: &mut Function, entry: Ebb) {
|
||||
pos.func.dfg.attach_ebb_param(entry, arg);
|
||||
match abi_type.purpose {
|
||||
ArgumentPurpose::Normal => {}
|
||||
ArgumentPurpose::FramePointer => {}
|
||||
ArgumentPurpose::CalleeSaved => {}
|
||||
ArgumentPurpose::StructReturn => {
|
||||
assert!(!has_sret, "Multiple sret arguments found");
|
||||
has_sret = true;
|
||||
|
||||
Reference in New Issue
Block a user