2006-05-14 22:18:28 +00:00
|
|
|
//===- ARMInstrInfo.td - Target Description for ARM Target ----------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the "Instituto Nokia de Tecnologia" and
|
|
|
|
// is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the ARM instructions in TableGen format.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-07-11 11:36:48 +00:00
|
|
|
// Address operands
|
|
|
|
def memri : Operand<iPTR> {
|
|
|
|
let PrintMethod = "printMemRegImm";
|
|
|
|
let NumMIOperands = 2;
|
|
|
|
let MIOperandInfo = (ops i32imm, ptr_rc);
|
|
|
|
}
|
|
|
|
|
2006-07-10 01:41:35 +00:00
|
|
|
// Define ARM specific addressing mode.
|
2006-07-11 11:36:48 +00:00
|
|
|
//register plus/minus 12 bit offset
|
2006-08-17 17:09:40 +00:00
|
|
|
def iaddr : ComplexPattern<iPTR, 2, "SelectAddrRegImm", [frameindex]>;
|
2006-07-11 11:36:48 +00:00
|
|
|
//register plus scaled register
|
|
|
|
//def raddr : ComplexPattern<iPTR, 2, "SelectAddrRegReg", []>;
|
2006-05-14 22:18:28 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instructions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
class InstARM<dag ops, string asmstr, list<dag> pattern> : Instruction {
|
|
|
|
let Namespace = "ARM";
|
|
|
|
|
|
|
|
dag OperandList = ops;
|
|
|
|
let AsmString = asmstr;
|
|
|
|
let Pattern = pattern;
|
|
|
|
}
|
|
|
|
|
2006-08-24 13:45:55 +00:00
|
|
|
def brtarget : Operand<OtherVT>;
|
|
|
|
|
2006-08-24 16:13:15 +00:00
|
|
|
// Operand for printing out a condition code.
|
|
|
|
let PrintMethod = "printCCOperand" in
|
|
|
|
def CCOp : Operand<i32>;
|
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
def SDT_ARMCallSeq : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>;
|
2006-08-11 09:03:33 +00:00
|
|
|
def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_ARMCallSeq,
|
|
|
|
[SDNPHasChain, SDNPOutFlag]>;
|
|
|
|
def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_ARMCallSeq,
|
|
|
|
[SDNPHasChain, SDNPOutFlag]>;
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2006-07-16 01:02:57 +00:00
|
|
|
def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisInt<0>]>;
|
|
|
|
def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
2006-08-03 17:02:20 +00:00
|
|
|
def retflag : SDNode<"ARMISD::RET_FLAG", SDTRet,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag]>;
|
2006-08-24 17:19:08 +00:00
|
|
|
|
|
|
|
def SDTarmselect : SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>, SDTCisVT<2, i32>]>;
|
|
|
|
|
|
|
|
def armselect : SDNode<"ARMISD::SELECT", SDTarmselect, [SDNPInFlag, SDNPOutFlag]>;
|
2006-08-21 22:00:32 +00:00
|
|
|
|
2006-08-24 16:13:15 +00:00
|
|
|
def SDTarmbr : SDTypeProfile<0, 2, [SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>;
|
2006-08-24 13:45:55 +00:00
|
|
|
def armbr : SDNode<"ARMISD::BR", SDTarmbr, [SDNPHasChain, SDNPInFlag]>;
|
|
|
|
|
2006-08-21 22:00:32 +00:00
|
|
|
def SDTVoidBinOp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
|
|
|
|
def armcmp : SDNode<"ARMISD::CMP", SDTVoidBinOp, [SDNPOutFlag]>;
|
2006-07-16 01:02:57 +00:00
|
|
|
|
2006-05-14 22:18:28 +00:00
|
|
|
def ADJCALLSTACKUP : InstARM<(ops i32imm:$amt),
|
|
|
|
"!ADJCALLSTACKUP $amt",
|
|
|
|
[(callseq_end imm:$amt)]>;
|
|
|
|
|
|
|
|
def ADJCALLSTACKDOWN : InstARM<(ops i32imm:$amt),
|
|
|
|
"!ADJCALLSTACKDOWN $amt",
|
|
|
|
[(callseq_start imm:$amt)]>;
|
|
|
|
|
2006-07-18 17:00:30 +00:00
|
|
|
let isReturn = 1 in {
|
2006-08-03 17:02:20 +00:00
|
|
|
def bx: InstARM<(ops), "bx r14", [(retflag)]>;
|
2006-07-18 17:00:30 +00:00
|
|
|
}
|
2006-05-18 21:45:49 +00:00
|
|
|
|
2006-08-16 14:43:33 +00:00
|
|
|
let Defs = [R0, R1, R2, R3, R14] in {
|
2006-08-01 18:53:10 +00:00
|
|
|
def bl: InstARM<(ops i32imm:$func, variable_ops), "bl $func", [(ARMcall tglobaladdr:$func)]>;
|
|
|
|
}
|
2006-07-16 01:02:57 +00:00
|
|
|
|
2006-07-11 11:36:48 +00:00
|
|
|
def ldr : InstARM<(ops IntRegs:$dst, memri:$addr),
|
2006-08-01 18:53:10 +00:00
|
|
|
"ldr $dst, $addr",
|
2006-07-11 11:36:48 +00:00
|
|
|
[(set IntRegs:$dst, (load iaddr:$addr))]>;
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2006-08-08 20:35:03 +00:00
|
|
|
def str : InstARM<(ops IntRegs:$src, memri:$addr),
|
|
|
|
"str $src, $addr",
|
|
|
|
[(store IntRegs:$src, iaddr:$addr)]>;
|
2006-05-14 22:18:28 +00:00
|
|
|
|
2006-05-18 21:45:49 +00:00
|
|
|
def movrr : InstARM<(ops IntRegs:$dst, IntRegs:$src),
|
|
|
|
"mov $dst, $src", []>;
|
|
|
|
|
|
|
|
def movri : InstARM<(ops IntRegs:$dst, i32imm:$src),
|
|
|
|
"mov $dst, $src", [(set IntRegs:$dst, imm:$src)]>;
|
2006-06-18 00:08:07 +00:00
|
|
|
|
|
|
|
def addri : InstARM<(ops IntRegs:$dst, IntRegs:$a, i32imm:$b),
|
|
|
|
"add $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (add IntRegs:$a, imm:$b))]>;
|
2006-07-21 12:26:16 +00:00
|
|
|
|
2006-08-17 17:09:40 +00:00
|
|
|
// "LEA" forms of add
|
|
|
|
def lea_addri : InstARM<(ops IntRegs:$dst, memri:$addr),
|
|
|
|
"add $dst, ${addr:arith}",
|
|
|
|
[(set IntRegs:$dst, iaddr:$addr)]>;
|
|
|
|
|
|
|
|
|
2006-07-21 12:26:16 +00:00
|
|
|
def subri : InstARM<(ops IntRegs:$dst, IntRegs:$a, i32imm:$b),
|
|
|
|
"sub $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (sub IntRegs:$a, imm:$b))]>;
|
2006-08-21 13:58:59 +00:00
|
|
|
|
|
|
|
def andrr : InstARM<(ops IntRegs:$dst, IntRegs:$a, IntRegs:$b),
|
|
|
|
"and $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (and IntRegs:$a, IntRegs:$b))]>;
|
2006-08-21 22:00:32 +00:00
|
|
|
|
|
|
|
let isTwoAddress = 1 in {
|
2006-08-24 17:19:08 +00:00
|
|
|
def movcond : InstARM<(ops IntRegs:$dst, IntRegs:$false, IntRegs:$true, CCOp:$cc),
|
|
|
|
"mov$cc $dst, $true",
|
|
|
|
[(set IntRegs:$dst, (armselect IntRegs:$true, IntRegs:$false, imm:$cc))]>;
|
2006-08-21 22:00:32 +00:00
|
|
|
}
|
|
|
|
|
2006-08-24 16:13:15 +00:00
|
|
|
def bcond : InstARM<(ops brtarget:$dst, CCOp:$cc),
|
|
|
|
"b$cc $dst",
|
|
|
|
[(armbr bb:$dst, imm:$cc)]>;
|
2006-08-24 13:45:55 +00:00
|
|
|
|
2006-08-21 22:00:32 +00:00
|
|
|
def cmp : InstARM<(ops IntRegs:$a, IntRegs:$b),
|
|
|
|
"cmp $a, $b",
|
|
|
|
[(armcmp IntRegs:$a, IntRegs:$b)]>;
|