mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-06-10 15:29:52 +00:00
105 lines
3.0 KiB
TableGen
105 lines
3.0 KiB
TableGen
//===-- Mos6502InstrInfo.td - Target Description for Mos6502 Target -------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file describes the Mos6502 instructions in TableGen format.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Instruction format superclass
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
include "Mos6502InstrFormats.td"
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Addition
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/*
|
|
let isCommutable = 1,
|
|
Defs = [A, SREG] in
|
|
{
|
|
// ADC imm
|
|
// Adds two 8-bit registers.
|
|
def ADCImm : InstM6502<(outs),
|
|
(ins i8imm:$k),
|
|
"adc #$k",
|
|
[(set A, (add A, i8imm:$k)),
|
|
(implicit SREG)]>;
|
|
}
|
|
*/
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Increment and Decrement
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
let Defs = [X, SREG] in
|
|
{
|
|
def INX : InstM6502<(outs XR:$dst),
|
|
(ins XR:$src),
|
|
"inx",
|
|
[(set XR:$dst, (add XR:$src, 1)), (implicit SREG)]>;
|
|
|
|
def DEX : InstM6502<(outs XR:$dst),
|
|
(ins XR:$src),
|
|
"dex",
|
|
[(set XR:$dst, (sub XR:$src, 1)), (implicit SREG)]>;
|
|
}
|
|
|
|
let Defs = [Y, SREG] in
|
|
{
|
|
def INY : InstM6502<(outs YR:$dst),
|
|
(ins YR:$src),
|
|
"iny",
|
|
[(set YR:$dst, (add YR:$src, 1)), (implicit SREG)]>;
|
|
|
|
def DEY : InstM6502<(outs YR:$dst),
|
|
(ins YR:$src),
|
|
"dey",
|
|
[(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", []>;
|
|
def ADJCALLSTACKUP : Pseudo<(outs), (ins), "#ADJCALLSTACKUP", []>;
|