2009-05-03 12:57:15 +00:00
|
|
|
//===- MSP430InstrInfo.td - MSP430 Instruction defs -----------*- tblgen-*-===//
|
|
|
|
//
|
|
|
|
// 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 MSP430 instructions in TableGen format.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "MSP430InstrFormats.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Type Constraints.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
class SDTCisI8<int OpNum> : SDTCisVT<OpNum, i8>;
|
|
|
|
class SDTCisI16<int OpNum> : SDTCisVT<OpNum, i16>;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Type Profiles.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// MSP430 Specific Node Definitions.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-05-03 13:03:33 +00:00
|
|
|
def MSP430retflag : SDNode<"MSP430ISD::RET_FLAG", SDTNone,
|
2009-05-03 12:59:50 +00:00
|
|
|
[SDNPHasChain, SDNPOptInFlag]>;
|
2009-05-03 12:57:15 +00:00
|
|
|
|
2009-05-03 13:03:33 +00:00
|
|
|
def MSP430rra : SDNode<"MSP430ISD::RRA", SDTIntUnaryOp, []>;
|
|
|
|
|
2009-05-03 12:57:15 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pseudo Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-05-03 13:04:23 +00:00
|
|
|
let neverHasSideEffects = 1 in
|
2009-05-03 12:57:15 +00:00
|
|
|
def NOP : Pseudo<(outs), (ins), "nop", []>;
|
2009-05-03 12:59:50 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Real Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// FIXME: Provide proper encoding!
|
|
|
|
let isReturn = 1, isTerminator = 1 in {
|
2009-05-03 13:03:33 +00:00
|
|
|
def RETI : Pseudo<(outs), (ins), "ret", [(MSP430retflag)]>;
|
2009-05-03 13:02:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Move Instructions
|
|
|
|
|
|
|
|
// FIXME: Provide proper encoding!
|
|
|
|
let neverHasSideEffects = 1 in {
|
|
|
|
def MOV16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src),
|
|
|
|
"mov.w\t{$src, $dst|$dst, $src}",
|
|
|
|
[]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Provide proper encoding!
|
|
|
|
let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
|
|
|
|
def MOV16ri : Pseudo<(outs GR16:$dst), (ins i16imm:$src),
|
|
|
|
"mov.w\t{$src, $dst|$dst, $src}",
|
|
|
|
[(set GR16:$dst, imm:$src)]>;
|
2009-05-03 12:59:50 +00:00
|
|
|
}
|
2009-05-03 13:02:39 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Arithmetic Instructions
|
|
|
|
|
2009-05-03 13:04:06 +00:00
|
|
|
let isTwoAddress = 1 in {
|
|
|
|
|
2009-05-03 13:05:22 +00:00
|
|
|
let Defs = [SRW] in {
|
2009-05-03 13:02:39 +00:00
|
|
|
|
2009-05-03 13:04:06 +00:00
|
|
|
let isCommutable = 1 in { // X = ADD Y, Z == X = ADD Z, Y
|
2009-05-03 13:02:39 +00:00
|
|
|
// FIXME: Provide proper encoding!
|
|
|
|
def ADD16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
"add.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (add GR16:$src1, GR16:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def ADD16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
|
|
|
|
"add.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (add GR16:$src1, imm:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:06 +00:00
|
|
|
|
2009-05-03 13:05:22 +00:00
|
|
|
let Uses = [SRW] in {
|
2009-05-03 13:04:41 +00:00
|
|
|
|
|
|
|
let isCommutable = 1 in { // X = ADDC Y, Z == X = ADDC Z, Y
|
2009-05-03 13:04:06 +00:00
|
|
|
def ADC16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
"addc.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (adde GR16:$src1, GR16:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:41 +00:00
|
|
|
} // isCommutable
|
|
|
|
|
|
|
|
def ADC16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
|
|
|
|
"addc.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (adde GR16:$src1, imm:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let isCommutable = 1 in { // X = AND Y, Z == X = AND Z, Y
|
|
|
|
def AND16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
"and.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (and GR16:$src1, GR16:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:06 +00:00
|
|
|
}
|
|
|
|
|
2009-05-03 13:04:41 +00:00
|
|
|
def AND16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
|
|
|
|
"and.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (and GR16:$src1, imm:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:41 +00:00
|
|
|
|
|
|
|
let isCommutable = 1 in { // X = XOR Y, Z == X = XOR Z, Y
|
2009-05-03 13:04:06 +00:00
|
|
|
def XOR16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
"xor.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (xor GR16:$src1, GR16:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:06 +00:00
|
|
|
}
|
|
|
|
|
2009-05-03 13:04:41 +00:00
|
|
|
def XOR16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
|
|
|
|
"xor.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (xor GR16:$src1, imm:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:41 +00:00
|
|
|
|
2009-05-03 13:04:06 +00:00
|
|
|
|
|
|
|
def SUB16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
"sub.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (sub GR16:$src1, GR16:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:06 +00:00
|
|
|
|
2009-05-03 13:04:41 +00:00
|
|
|
def SUB16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
|
|
|
|
"sub.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (sub GR16:$src1, imm:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:41 +00:00
|
|
|
|
2009-05-03 13:05:22 +00:00
|
|
|
let Uses = [SRW] in {
|
2009-05-03 13:04:06 +00:00
|
|
|
def SBC16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
"subc.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (sube GR16:$src1, GR16:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:04:41 +00:00
|
|
|
|
|
|
|
def SBC16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
|
|
|
|
"subc.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (sube GR16:$src1, imm:$src2)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
2009-05-03 13:02:39 +00:00
|
|
|
}
|
2009-05-03 13:03:33 +00:00
|
|
|
|
|
|
|
// FIXME: Provide proper encoding!
|
|
|
|
def SAR16r1 : Pseudo<(outs GR16:$dst), (ins GR16:$src),
|
|
|
|
"rra.w\t$dst",
|
|
|
|
[(set GR16:$dst, (MSP430rra GR16:$src)),
|
2009-05-03 13:05:22 +00:00
|
|
|
(implicit SRW)]>;
|
|
|
|
|
|
|
|
def SEXT16r : Pseudo<(outs GR16:$dst), (ins GR16:$src),
|
|
|
|
"sxt\t$dst",
|
|
|
|
[(set GR16:$dst, (sext_inreg GR16:$src, i8)),
|
|
|
|
(implicit SRW)]>;
|
|
|
|
|
|
|
|
} // Defs = [SRW]
|
2009-05-03 13:05:00 +00:00
|
|
|
|
|
|
|
let isCommutable = 1 in { // X = OR Y, Z == X = OR Z, Y
|
|
|
|
def OR16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
"bis.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
def OR16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
|
|
|
|
"bis.w\t{$src2, $dst|$dst, $src2}",
|
|
|
|
[(set GR16:$dst, (or GR16:$src1, imm:$src2))]>;
|
|
|
|
|
2009-05-03 13:04:06 +00:00
|
|
|
} // isTwoAddress = 1
|