Def PHA, PLA, PHP, PLP

This commit is contained in:
Damián Silvani 2015-08-07 01:24:00 -03:00
parent 5445972c1b
commit d372790f92
2 changed files with 43 additions and 1 deletions

View File

@ -11,11 +11,19 @@
//
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// 6502 Return Value Calling Convention
//===----------------------------------------------------------------------===//
def CC_Mos6502 : CallingConv<[
CCIfType<[i8], CCAssignToReg<[A, X, Y]>>,
CCAssignToStack<0, 0>
CCAssignToStack<1, 1>
]>;
def RetCC_Mos650232 : CallingConv<[
CCIfType<[i8], CCAssignToReg<[A, X, Y]>>
]>;
//===----------------------------------------------------------------------===//
// 6502 Argument Calling Conventions
//===----------------------------------------------------------------------===//

View File

@ -38,6 +38,7 @@ Defs = [A, SREG] in
//===----------------------------------------------------------------------===//
// Increment and Decrement
//===----------------------------------------------------------------------===//
let Defs = [X, SREG] in
{
def INX : InstM6502<(outs XR:$dst),
@ -64,6 +65,39 @@ let Defs = [Y, SREG] in
[(set YR:$dst, (sub YR:$src, 1)), (implicit SREG)]>;
}
//===----------------------------------------------------------------------===//
// Stack operations
//===----------------------------------------------------------------------===//
let Defs = [SP],
Uses = [SP] in
{
// Push accumulator on stack
let mayStore = 1 in {
def PHA : InstM6502<(outs), (ins AR:$a), "pha", []>;
}
// Pop from stack into accumulator
let mayLoad = 1 in {
def PLA : InstM6502<(outs AR:$a), (ins), "pla", []>;
}
}
let Defs = [SP],
Uses = [SP, SREG],
mayStore = 1 in
{
def PHP : InstM6502<(outs), (ins CCR:$c), "php", []>;
}
let Defs = [SP, SREG],
Uses = [SP],
mayLoad = 1 in
{
def PLP : InstM6502<(outs CCR:$c), (ins), "plp", []>;
}
def NOP : InstM6502<(outs), (ins), "nop", []>;
def ADJCALLSTACKDOWN : Pseudo<(outs), (ins), "#ADJCALLSTACKDOWN", []>;