LLVM API Documentation
00001 //===-- ARMISelLowering.h - ARM DAG Lowering Interface ----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the interfaces that ARM uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef ARMISELLOWERING_H 00016 #define ARMISELLOWERING_H 00017 00018 #include "ARMSubtarget.h" 00019 #include "llvm/Target/TargetLowering.h" 00020 #include "llvm/CodeGen/SelectionDAG.h" 00021 #include <vector> 00022 00023 namespace llvm { 00024 class ARMConstantPoolValue; 00025 00026 namespace ARMISD { 00027 // ARM Specific DAG Nodes 00028 enum NodeType { 00029 // Start the numbering where the builting ops and target ops leave off. 00030 FIRST_NUMBER = ISD::BUILTIN_OP_END, 00031 00032 Wrapper, // Wrapper - A wrapper node for TargetConstantPool, 00033 // TargetExternalSymbol, and TargetGlobalAddress. 00034 WrapperJT, // WrapperJT - A wrapper node for TargetJumpTable 00035 00036 CALL, // Function call. 00037 CALL_PRED, // Function call that's predicable. 00038 CALL_NOLINK, // Function call with branch not branch-and-link. 00039 tCALL, // Thumb function call. 00040 BRCOND, // Conditional branch. 00041 BR_JT, // Jumptable branch. 00042 RET_FLAG, // Return with a flag operand. 00043 00044 PIC_ADD, // Add with a PC operand and a PIC label. 00045 00046 CMP, // ARM compare instructions. 00047 CMPNZ, // ARM compare that uses only N or Z flags. 00048 CMPFP, // ARM VFP compare instruction, sets FPSCR. 00049 CMPFPw0, // ARM VFP compare against zero instruction, sets FPSCR. 00050 FMSTAT, // ARM fmstat instruction. 00051 CMOV, // ARM conditional move instructions. 00052 CNEG, // ARM conditional negate instructions. 00053 00054 FTOSI, // FP to sint within a FP register. 00055 FTOUI, // FP to uint within a FP register. 00056 SITOF, // sint to FP within a FP register. 00057 UITOF, // uint to FP within a FP register. 00058 00059 SRL_FLAG, // V,Flag = srl_flag X -> srl X, 1 + save carry out. 00060 SRA_FLAG, // V,Flag = sra_flag X -> sra X, 1 + save carry out. 00061 RRX, // V = RRX X, Flag -> srl X, 1 + shift in carry flag. 00062 00063 FMRRD, // double to two gprs. 00064 FMDRR, // Two gprs to double. 00065 00066 THREAD_POINTER 00067 }; 00068 } 00069 00070 //===----------------------------------------------------------------------===// 00071 // ARMTargetLowering - ARM Implementation of the TargetLowering interface 00072 00073 class ARMTargetLowering : public TargetLowering { 00074 int VarArgsFrameIndex; // FrameIndex for start of varargs area. 00075 public: 00076 explicit ARMTargetLowering(TargetMachine &TM); 00077 00078 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00079 00080 /// ReplaceNodeResults - Replace the results of node with an illegal result 00081 /// type with new values built out of custom code. 00082 /// 00083 virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, 00084 SelectionDAG &DAG); 00085 00086 virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; 00087 00088 virtual const char *getTargetNodeName(unsigned Opcode) const; 00089 00090 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, 00091 MachineBasicBlock *MBB); 00092 00093 /// isLegalAddressingMode - Return true if the addressing mode represented 00094 /// by AM is legal for this target, for a load/store of the specified type. 00095 virtual bool isLegalAddressingMode(const AddrMode &AM, const Type *Ty)const; 00096 00097 /// getPreIndexedAddressParts - returns true by value, base pointer and 00098 /// offset pointer and addressing mode by reference if the node's address 00099 /// can be legally represented as pre-indexed load / store address. 00100 virtual bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, 00101 SDValue &Offset, 00102 ISD::MemIndexedMode &AM, 00103 SelectionDAG &DAG); 00104 00105 /// getPostIndexedAddressParts - returns true by value, base pointer and 00106 /// offset pointer and addressing mode by reference if this node can be 00107 /// combined with a load / store to form a post-indexed load / store. 00108 virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, 00109 SDValue &Base, SDValue &Offset, 00110 ISD::MemIndexedMode &AM, 00111 SelectionDAG &DAG); 00112 00113 virtual void computeMaskedBitsForTargetNode(const SDValue Op, 00114 const APInt &Mask, 00115 APInt &KnownZero, 00116 APInt &KnownOne, 00117 const SelectionDAG &DAG, 00118 unsigned Depth) const; 00119 ConstraintType getConstraintType(const std::string &Constraint) const; 00120 std::pair<unsigned, const TargetRegisterClass*> 00121 getRegForInlineAsmConstraint(const std::string &Constraint, 00122 MVT VT) const; 00123 std::vector<unsigned> 00124 getRegClassForInlineAsmConstraint(const std::string &Constraint, 00125 MVT VT) const; 00126 00127 virtual const ARMSubtarget* getSubtarget() { 00128 return Subtarget; 00129 } 00130 00131 private: 00132 /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can 00133 /// make the right decision when generating code for different targets. 00134 const ARMSubtarget *Subtarget; 00135 00136 /// ARMPCLabelIndex - Keep track the number of ARM PC labels created. 00137 /// 00138 unsigned ARMPCLabelIndex; 00139 00140 SDValue LowerCALL(SDValue Op, SelectionDAG &DAG); 00141 SDValue LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG); 00142 SDValue LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG); 00143 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG); 00144 SDValue LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA, 00145 SelectionDAG &DAG); 00146 SDValue LowerToTLSExecModels(GlobalAddressSDNode *GA, 00147 SelectionDAG &DAG); 00148 SDValue LowerGLOBAL_OFFSET_TABLE(SDValue Op, SelectionDAG &DAG); 00149 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); 00150 SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG); 00151 00152 SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, 00153 SDValue Chain, 00154 SDValue Dst, SDValue Src, 00155 SDValue Size, unsigned Align, 00156 bool AlwaysInline, 00157 const Value *DstSV, uint64_t DstSVOff, 00158 const Value *SrcSV, uint64_t SrcSVOff); 00159 }; 00160 } 00161 00162 #endif // ARMISELLOWERING_H
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.