Update comments.
[llvm/msp430.git] / lib / Target / ARM / ARMISelLowering.h
blob4c49350c327505c31acee01de1ed1b7f917e2e94
1 //===-- ARMISelLowering.h - ARM DAG Lowering Interface ----------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the interfaces that ARM uses to lower LLVM code into a
11 // selection DAG.
13 //===----------------------------------------------------------------------===//
15 #ifndef ARMISELLOWERING_H
16 #define ARMISELLOWERING_H
18 #include "ARMSubtarget.h"
19 #include "llvm/Target/TargetLowering.h"
20 #include "llvm/CodeGen/SelectionDAG.h"
21 #include "llvm/CodeGen/CallingConvLower.h"
22 #include <vector>
24 namespace llvm {
25 class ARMConstantPoolValue;
27 namespace ARMISD {
28 // ARM Specific DAG Nodes
29 enum NodeType {
30 // Start the numbering where the builting ops and target ops leave off.
31 FIRST_NUMBER = ISD::BUILTIN_OP_END,
33 Wrapper, // Wrapper - A wrapper node for TargetConstantPool,
34 // TargetExternalSymbol, and TargetGlobalAddress.
35 WrapperJT, // WrapperJT - A wrapper node for TargetJumpTable
37 CALL, // Function call.
38 CALL_PRED, // Function call that's predicable.
39 CALL_NOLINK, // Function call with branch not branch-and-link.
40 tCALL, // Thumb function call.
41 BRCOND, // Conditional branch.
42 BR_JT, // Jumptable branch.
43 RET_FLAG, // Return with a flag operand.
45 PIC_ADD, // Add with a PC operand and a PIC label.
47 CMP, // ARM compare instructions.
48 CMPNZ, // ARM compare that uses only N or Z flags.
49 CMPFP, // ARM VFP compare instruction, sets FPSCR.
50 CMPFPw0, // ARM VFP compare against zero instruction, sets FPSCR.
51 FMSTAT, // ARM fmstat instruction.
52 CMOV, // ARM conditional move instructions.
53 CNEG, // ARM conditional negate instructions.
55 FTOSI, // FP to sint within a FP register.
56 FTOUI, // FP to uint within a FP register.
57 SITOF, // sint to FP within a FP register.
58 UITOF, // uint to FP within a FP register.
60 SRL_FLAG, // V,Flag = srl_flag X -> srl X, 1 + save carry out.
61 SRA_FLAG, // V,Flag = sra_flag X -> sra X, 1 + save carry out.
62 RRX, // V = RRX X, Flag -> srl X, 1 + shift in carry flag.
64 FMRRD, // double to two gprs.
65 FMDRR, // Two gprs to double.
67 THREAD_POINTER
71 //===----------------------------------------------------------------------===//
72 // ARMTargetLowering - ARM Implementation of the TargetLowering interface
74 class ARMTargetLowering : public TargetLowering {
75 int VarArgsFrameIndex; // FrameIndex for start of varargs area.
76 public:
77 explicit ARMTargetLowering(TargetMachine &TM);
79 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
81 /// ReplaceNodeResults - Replace the results of node with an illegal result
82 /// type with new values built out of custom code.
83 ///
84 virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
85 SelectionDAG &DAG);
87 virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
89 virtual const char *getTargetNodeName(unsigned Opcode) const;
91 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
92 MachineBasicBlock *MBB) const;
94 /// isLegalAddressingMode - Return true if the addressing mode represented
95 /// by AM is legal for this target, for a load/store of the specified type.
96 virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty)const;
98 /// getPreIndexedAddressParts - returns true by value, base pointer and
99 /// offset pointer and addressing mode by reference if the node's address
100 /// can be legally represented as pre-indexed load / store address.
101 virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
102 SDValue &Offset,
103 ISD::MemIndexedMode &AM,
104 SelectionDAG &DAG) const;
106 /// getPostIndexedAddressParts - returns true by value, base pointer and
107 /// offset pointer and addressing mode by reference if this node can be
108 /// combined with a load / store to form a post-indexed load / store.
109 virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op,
110 SDValue &Base, SDValue &Offset,
111 ISD::MemIndexedMode &AM,
112 SelectionDAG &DAG) const;
114 virtual void computeMaskedBitsForTargetNode(const SDValue Op,
115 const APInt &Mask,
116 APInt &KnownZero,
117 APInt &KnownOne,
118 const SelectionDAG &DAG,
119 unsigned Depth) const;
120 ConstraintType getConstraintType(const std::string &Constraint) const;
121 std::pair<unsigned, const TargetRegisterClass*>
122 getRegForInlineAsmConstraint(const std::string &Constraint,
123 MVT VT) const;
124 std::vector<unsigned>
125 getRegClassForInlineAsmConstraint(const std::string &Constraint,
126 MVT VT) const;
128 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
129 /// vector. If it is invalid, don't add anything to Ops. If hasMemory is
130 /// true it means one of the asm constraint of the inline asm instruction
131 /// being processed is 'm'.
132 virtual void LowerAsmOperandForConstraint(SDValue Op,
133 char ConstraintLetter,
134 bool hasMemory,
135 std::vector<SDValue> &Ops,
136 SelectionDAG &DAG) const;
138 virtual const ARMSubtarget* getSubtarget() {
139 return Subtarget;
142 private:
143 /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
144 /// make the right decision when generating code for different targets.
145 const ARMSubtarget *Subtarget;
147 /// ARMPCLabelIndex - Keep track the number of ARM PC labels created.
149 unsigned ARMPCLabelIndex;
151 SDValue LowerMemOpCallTo(CallSDNode *TheCall, SelectionDAG &DAG,
152 const SDValue &StackPtr, const CCValAssign &VA,
153 SDValue Chain, SDValue Arg, ISD::ArgFlagsTy Flags);
154 SDNode *LowerCallResult(SDValue Chain, SDValue InFlag, CallSDNode *TheCall,
155 unsigned CallingConv, SelectionDAG &DAG);
156 SDValue LowerCALL(SDValue Op, SelectionDAG &DAG);
157 SDValue LowerRET(SDValue Op, SelectionDAG &DAG);
158 SDValue LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG);
159 SDValue LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG);
160 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG);
161 SDValue LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
162 SelectionDAG &DAG);
163 SDValue LowerToTLSExecModels(GlobalAddressSDNode *GA,
164 SelectionDAG &DAG);
165 SDValue LowerGLOBAL_OFFSET_TABLE(SDValue Op, SelectionDAG &DAG);
166 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG);
167 SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG);
169 SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
170 SDValue Chain,
171 SDValue Dst, SDValue Src,
172 SDValue Size, unsigned Align,
173 bool AlwaysInline,
174 const Value *DstSV, uint64_t DstSVOff,
175 const Value *SrcSV, uint64_t SrcSVOff);
179 #endif // ARMISELLOWERING_H