2006-05-15 06:18:28 +08: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 19:36:48 +08:00
|
|
|
// Address operands
|
2006-09-12 01:25:40 +08:00
|
|
|
def op_addr_mode1 : Operand<iPTR> {
|
|
|
|
let PrintMethod = "printAddrMode1";
|
2006-09-13 20:09:43 +08:00
|
|
|
let NumMIOperands = 3;
|
|
|
|
let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm);
|
2006-09-12 01:25:40 +08:00
|
|
|
}
|
|
|
|
|
2006-07-11 19:36:48 +08:00
|
|
|
def memri : Operand<iPTR> {
|
|
|
|
let PrintMethod = "printMemRegImm";
|
|
|
|
let NumMIOperands = 2;
|
|
|
|
let MIOperandInfo = (ops i32imm, ptr_rc);
|
|
|
|
}
|
|
|
|
|
2006-07-10 09:41:35 +08:00
|
|
|
// Define ARM specific addressing mode.
|
2006-09-12 01:25:40 +08:00
|
|
|
//Addressing Mode 1: data processing operands
|
2006-09-13 20:09:43 +08:00
|
|
|
def addr_mode1 : ComplexPattern<iPTR, 3, "SelectAddrMode1", [imm, sra, shl, srl]>;
|
2006-09-12 01:25:40 +08:00
|
|
|
|
2006-07-11 19:36:48 +08:00
|
|
|
//register plus/minus 12 bit offset
|
2006-08-18 01:09:40 +08:00
|
|
|
def iaddr : ComplexPattern<iPTR, 2, "SelectAddrRegImm", [frameindex]>;
|
2006-07-11 19:36:48 +08:00
|
|
|
//register plus scaled register
|
|
|
|
//def raddr : ComplexPattern<iPTR, 2, "SelectAddrRegReg", []>;
|
2006-05-15 06:18:28 +08: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 21:45:55 +08:00
|
|
|
def brtarget : Operand<OtherVT>;
|
|
|
|
|
2006-08-25 00:13:15 +08:00
|
|
|
// Operand for printing out a condition code.
|
|
|
|
let PrintMethod = "printCCOperand" in
|
|
|
|
def CCOp : Operand<i32>;
|
|
|
|
|
2006-05-15 06:18:28 +08:00
|
|
|
def SDT_ARMCallSeq : SDTypeProfile<0, 1, [ SDTCisVT<0, i32> ]>;
|
2006-08-11 17:03:33 +08: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-15 06:18:28 +08:00
|
|
|
|
2006-07-16 09:02:57 +08:00
|
|
|
def SDT_ARMcall : SDTypeProfile<0, -1, [SDTCisInt<0>]>;
|
|
|
|
def ARMcall : SDNode<"ARMISD::CALL", SDT_ARMcall,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
2006-08-04 01:02:20 +08:00
|
|
|
def retflag : SDNode<"ARMISD::RET_FLAG", SDTRet,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag]>;
|
2006-08-25 01:19:08 +08: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-22 06:00:32 +08:00
|
|
|
|
2006-08-25 00:13:15 +08:00
|
|
|
def SDTarmbr : SDTypeProfile<0, 2, [SDTCisVT<0, OtherVT>, SDTCisVT<1, i32>]>;
|
2006-08-24 21:45:55 +08:00
|
|
|
def armbr : SDNode<"ARMISD::BR", SDTarmbr, [SDNPHasChain, SDNPInFlag]>;
|
|
|
|
|
2006-08-22 06:00:32 +08:00
|
|
|
def SDTVoidBinOp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
|
|
|
|
def armcmp : SDNode<"ARMISD::CMP", SDTVoidBinOp, [SDNPOutFlag]>;
|
2006-07-16 09:02:57 +08:00
|
|
|
|
2006-10-07 22:24:52 +08:00
|
|
|
def armfsitos : SDNode<"ARMISD::FSITOS", SDTUnaryOp>;
|
2006-10-03 03:30:56 +08:00
|
|
|
def armfsitod : SDNode<"ARMISD::FSITOD", SDTUnaryOp>;
|
2006-10-07 22:24:52 +08:00
|
|
|
def armfuitos : SDNode<"ARMISD::FUITOS", SDTUnaryOp>;
|
|
|
|
def armfuitod : SDNode<"ARMISD::FUITOD", SDTUnaryOp>;
|
2006-10-03 03:30:56 +08:00
|
|
|
|
|
|
|
def SDTarmfmrrd : SDTypeProfile<0, 3, [SDTCisInt<0>, SDTCisInt<1>, SDTCisFP<2>]>;
|
2006-10-07 04:33:26 +08:00
|
|
|
def armfmrrd : SDNode<"ARMISD::FMRRD", SDTarmfmrrd,
|
|
|
|
[SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
|
2006-09-30 05:20:16 +08:00
|
|
|
|
2006-10-06 00:48:49 +08:00
|
|
|
def SDTarmfmdrr : SDTypeProfile<1, 2, [SDTCisFP<0>, SDTCisInt<1>, SDTCisInt<2>]>;
|
|
|
|
def armfmdrr : SDNode<"ARMISD::FMDRR", SDTarmfmdrr, []>;
|
|
|
|
|
2006-05-15 06:18:28 +08: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-19 01:00:30 +08:00
|
|
|
let isReturn = 1 in {
|
2006-08-04 01:02:20 +08:00
|
|
|
def bx: InstARM<(ops), "bx r14", [(retflag)]>;
|
2006-07-19 01:00:30 +08:00
|
|
|
}
|
2006-05-19 05:45:49 +08:00
|
|
|
|
2006-08-16 22:43:33 +08:00
|
|
|
let Defs = [R0, R1, R2, R3, R14] in {
|
2006-08-02 02:53:10 +08:00
|
|
|
def bl: InstARM<(ops i32imm:$func, variable_ops), "bl $func", [(ARMcall tglobaladdr:$func)]>;
|
|
|
|
}
|
2006-07-16 09:02:57 +08:00
|
|
|
|
2006-07-11 19:36:48 +08:00
|
|
|
def ldr : InstARM<(ops IntRegs:$dst, memri:$addr),
|
2006-08-02 02:53:10 +08:00
|
|
|
"ldr $dst, $addr",
|
2006-07-11 19:36:48 +08:00
|
|
|
[(set IntRegs:$dst, (load iaddr:$addr))]>;
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2006-08-09 04:35:03 +08:00
|
|
|
def str : InstARM<(ops IntRegs:$src, memri:$addr),
|
|
|
|
"str $src, $addr",
|
|
|
|
[(store IntRegs:$src, iaddr:$addr)]>;
|
2006-05-15 06:18:28 +08:00
|
|
|
|
2006-09-12 01:25:40 +08:00
|
|
|
def MOV : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src),
|
|
|
|
"mov $dst, $src", [(set IntRegs:$dst, addr_mode1:$src)]>;
|
2006-06-18 08:08:07 +08:00
|
|
|
|
2006-09-12 01:25:40 +08:00
|
|
|
def ADD : InstARM<(ops IntRegs:$dst, IntRegs:$a, op_addr_mode1:$b),
|
2006-06-18 08:08:07 +08:00
|
|
|
"add $dst, $a, $b",
|
2006-09-12 01:25:40 +08:00
|
|
|
[(set IntRegs:$dst, (add IntRegs:$a, addr_mode1:$b))]>;
|
2006-07-21 20:26:16 +08:00
|
|
|
|
2006-10-10 01:18:28 +08:00
|
|
|
def ADCS : InstARM<(ops IntRegs:$dst, IntRegs:$a, op_addr_mode1:$b),
|
|
|
|
"adcs $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (adde IntRegs:$a, addr_mode1:$b))]>;
|
|
|
|
|
|
|
|
def ADDS : InstARM<(ops IntRegs:$dst, IntRegs:$a, op_addr_mode1:$b),
|
|
|
|
"adds $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (addc IntRegs:$a, addr_mode1:$b))]>;
|
|
|
|
|
2006-08-18 01:09:40 +08:00
|
|
|
// "LEA" forms of add
|
|
|
|
def lea_addri : InstARM<(ops IntRegs:$dst, memri:$addr),
|
|
|
|
"add $dst, ${addr:arith}",
|
|
|
|
[(set IntRegs:$dst, iaddr:$addr)]>;
|
|
|
|
|
|
|
|
|
2006-09-12 01:25:40 +08:00
|
|
|
def SUB : InstARM<(ops IntRegs:$dst, IntRegs:$a, op_addr_mode1:$b),
|
2006-07-21 20:26:16 +08:00
|
|
|
"sub $dst, $a, $b",
|
2006-09-12 01:25:40 +08:00
|
|
|
[(set IntRegs:$dst, (sub IntRegs:$a, addr_mode1:$b))]>;
|
2006-08-22 06:00:32 +08:00
|
|
|
|
2006-09-12 01:25:40 +08:00
|
|
|
def AND : InstARM<(ops IntRegs:$dst, IntRegs:$a, op_addr_mode1:$b),
|
|
|
|
"and $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (and IntRegs:$a, addr_mode1:$b))]>;
|
2006-09-09 01:36:23 +08:00
|
|
|
|
2006-09-12 01:25:40 +08:00
|
|
|
def EOR : InstARM<(ops IntRegs:$dst, IntRegs:$a, op_addr_mode1:$b),
|
|
|
|
"eor $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (xor IntRegs:$a, addr_mode1:$b))]>;
|
2006-09-09 01:36:23 +08:00
|
|
|
|
2006-09-12 01:25:40 +08:00
|
|
|
def ORR : InstARM<(ops IntRegs:$dst, IntRegs:$a, op_addr_mode1:$b),
|
|
|
|
"orr $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (or IntRegs:$a, addr_mode1:$b))]>;
|
2006-09-09 00:59:47 +08:00
|
|
|
|
2006-08-22 06:00:32 +08:00
|
|
|
let isTwoAddress = 1 in {
|
2006-09-12 01:25:40 +08:00
|
|
|
def movcond : InstARM<(ops IntRegs:$dst, IntRegs:$false,
|
|
|
|
op_addr_mode1:$true, CCOp:$cc),
|
2006-08-25 01:19:08 +08:00
|
|
|
"mov$cc $dst, $true",
|
2006-09-12 01:25:40 +08:00
|
|
|
[(set IntRegs:$dst, (armselect addr_mode1:$true,
|
|
|
|
IntRegs:$false, imm:$cc))]>;
|
2006-08-22 06:00:32 +08:00
|
|
|
}
|
|
|
|
|
2006-09-12 03:24:19 +08:00
|
|
|
def MUL : InstARM<(ops IntRegs:$dst, IntRegs:$a, IntRegs:$b),
|
|
|
|
"mul $dst, $a, $b",
|
|
|
|
[(set IntRegs:$dst, (mul IntRegs:$a, IntRegs:$b))]>;
|
|
|
|
|
2006-08-25 00:13:15 +08:00
|
|
|
def bcond : InstARM<(ops brtarget:$dst, CCOp:$cc),
|
|
|
|
"b$cc $dst",
|
|
|
|
[(armbr bb:$dst, imm:$cc)]>;
|
2006-08-24 21:45:55 +08:00
|
|
|
|
2006-09-08 20:47:03 +08:00
|
|
|
def b : InstARM<(ops brtarget:$dst),
|
|
|
|
"b $dst",
|
|
|
|
[(br bb:$dst)]>;
|
|
|
|
|
2006-09-12 01:25:40 +08:00
|
|
|
def cmp : InstARM<(ops IntRegs:$a, op_addr_mode1:$b),
|
2006-08-22 06:00:32 +08:00
|
|
|
"cmp $a, $b",
|
2006-09-12 01:25:40 +08:00
|
|
|
[(armcmp IntRegs:$a, addr_mode1:$b)]>;
|
2006-09-30 05:20:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Floating Point Conversion
|
|
|
|
// We use bitconvert for moving the data between the register classes.
|
|
|
|
// The format conversion is done with ARM specific nodes
|
|
|
|
|
|
|
|
def FMSR : InstARM<(ops FPRegs:$dst, IntRegs:$src),
|
|
|
|
"fmsr $dst, $src", [(set FPRegs:$dst, (bitconvert IntRegs:$src))]>;
|
|
|
|
|
|
|
|
def FMRS : InstARM<(ops IntRegs:$dst, FPRegs:$src),
|
|
|
|
"fmrs $dst, $src", [(set IntRegs:$dst, (bitconvert FPRegs:$src))]>;
|
|
|
|
|
2006-10-03 03:30:56 +08:00
|
|
|
def FMRRD : InstARM<(ops IntRegs:$i0, IntRegs:$i1, DFPRegs:$src),
|
|
|
|
"fmrrd $i0, $i1, $src", [(armfmrrd IntRegs:$i0, IntRegs:$i1, DFPRegs:$src)]>;
|
|
|
|
|
2006-10-06 00:48:49 +08:00
|
|
|
def FMDRR : InstARM<(ops DFPRegs:$dst, IntRegs:$i0, IntRegs:$i1),
|
|
|
|
"fmdrr $dst, $i0, $i1", [(set DFPRegs:$dst, (armfmdrr IntRegs:$i0, IntRegs:$i1))]>;
|
|
|
|
|
2006-09-30 05:20:16 +08:00
|
|
|
def FSITOS : InstARM<(ops FPRegs:$dst, FPRegs:$src),
|
|
|
|
"fsitos $dst, $src", [(set FPRegs:$dst, (armfsitos FPRegs:$src))]>;
|
2006-10-03 03:30:56 +08:00
|
|
|
|
|
|
|
def FSITOD : InstARM<(ops DFPRegs:$dst, FPRegs:$src),
|
|
|
|
"fsitod $dst, $src", [(set DFPRegs:$dst, (armfsitod FPRegs:$src))]>;
|
2006-10-07 21:46:42 +08:00
|
|
|
|
2006-10-07 22:24:52 +08:00
|
|
|
def FUITOS : InstARM<(ops FPRegs:$dst, FPRegs:$src),
|
|
|
|
"fuitos $dst, $src", [(set FPRegs:$dst, (armfuitos FPRegs:$src))]>;
|
|
|
|
|
|
|
|
def FUITOD : InstARM<(ops DFPRegs:$dst, FPRegs:$src),
|
|
|
|
"fuitod $dst, $src", [(set DFPRegs:$dst, (armfuitod FPRegs:$src))]>;
|
|
|
|
|
2006-10-10 01:50:29 +08:00
|
|
|
def FCVTDS : InstARM<(ops DFPRegs:$dst, FPRegs:$src),
|
|
|
|
"fcvtds $dst, $src", [(set DFPRegs:$dst, (fextend FPRegs:$src))]>;
|
|
|
|
|
|
|
|
def FCVTSD : InstARM<(ops FPRegs:$dst, DFPRegs:$src),
|
|
|
|
"fcvtsd $dst, $src", [(set FPRegs:$dst, (fround DFPRegs:$src))]>;
|
2006-10-07 21:46:42 +08:00
|
|
|
|
|
|
|
// Floating Point Arithmetic
|
|
|
|
def FADDS : InstARM<(ops FPRegs:$dst, FPRegs:$a, FPRegs:$b),
|
|
|
|
"fadds $dst, $a, $b",
|
|
|
|
[(set FPRegs:$dst, (fadd FPRegs:$a, FPRegs:$b))]>;
|
|
|
|
|
|
|
|
def FADDD : InstARM<(ops DFPRegs:$dst, DFPRegs:$a, DFPRegs:$b),
|
|
|
|
"faddd $dst, $a, $b",
|
|
|
|
[(set DFPRegs:$dst, (fadd DFPRegs:$a, DFPRegs:$b))]>;
|
|
|
|
|
|
|
|
def FMULS : InstARM<(ops FPRegs:$dst, FPRegs:$a, FPRegs:$b),
|
|
|
|
"fmuls $dst, $a, $b",
|
|
|
|
[(set FPRegs:$dst, (fmul FPRegs:$a, FPRegs:$b))]>;
|
|
|
|
|
|
|
|
def FMULD : InstARM<(ops DFPRegs:$dst, DFPRegs:$a, DFPRegs:$b),
|
|
|
|
"fmuld $dst, $a, $b",
|
|
|
|
[(set DFPRegs:$dst, (fmul DFPRegs:$a, DFPRegs:$b))]>;
|
2006-10-07 22:03:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Floating Point Load
|
|
|
|
def FLDS : InstARM<(ops FPRegs:$dst, IntRegs:$addr),
|
|
|
|
"flds $dst, $addr",
|
|
|
|
[(set FPRegs:$dst, (load IntRegs:$addr))]>;
|
|
|
|
|
|
|
|
def FLDD : InstARM<(ops DFPRegs:$dst, IntRegs:$addr),
|
|
|
|
"fldd $dst, $addr",
|
|
|
|
[(set DFPRegs:$dst, (load IntRegs:$addr))]>;
|