LLVM API Documentation
00001 //===-- XCoreISelLowering.h - XCore 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 XCore uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef XCOREISELLOWERING_H 00016 #define XCOREISELLOWERING_H 00017 00018 #include "llvm/CodeGen/SelectionDAG.h" 00019 #include "llvm/Target/TargetLowering.h" 00020 #include "XCore.h" 00021 00022 namespace llvm { 00023 00024 // Forward delcarations 00025 class XCoreSubtarget; 00026 class XCoreTargetMachine; 00027 00028 namespace XCoreISD { 00029 enum NodeType { 00030 // Start the numbering where the builtin ops and target ops leave off. 00031 FIRST_NUMBER = ISD::BUILTIN_OP_END+XCore::INSTRUCTION_LIST_END, 00032 00033 // Branch and link (call) 00034 BL, 00035 00036 // pc relative address 00037 PCRelativeWrapper, 00038 00039 // dp relative address 00040 DPRelativeWrapper, 00041 00042 // cp relative address 00043 CPRelativeWrapper, 00044 00045 // Store word to stack 00046 STWSP, 00047 00048 // Corresponds to retsp instruction 00049 RETSP, 00050 00051 // Corresponds to LADD instruction 00052 LADD, 00053 00054 // Corresponds to LSUB instruction 00055 LSUB 00056 }; 00057 } 00058 00059 //===--------------------------------------------------------------------===// 00060 // TargetLowering Implementation 00061 //===--------------------------------------------------------------------===// 00062 class XCoreTargetLowering : public TargetLowering 00063 { 00064 public: 00065 00066 explicit XCoreTargetLowering(XCoreTargetMachine &TM); 00067 00068 /// LowerOperation - Provide custom lowering hooks for some operations. 00069 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00070 00071 /// ReplaceNodeResults - Replace the results of node with an illegal result 00072 /// type with new values built out of custom code. 00073 /// 00074 virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, 00075 SelectionDAG &DAG); 00076 00077 /// getTargetNodeName - This method returns the name of a target specific 00078 // DAG node. 00079 virtual const char *getTargetNodeName(unsigned Opcode) const; 00080 00081 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, 00082 MachineBasicBlock *MBB); 00083 00084 virtual bool isLegalAddressingMode(const AddrMode &AM, 00085 const Type *Ty) const; 00086 00087 private: 00088 const XCoreTargetMachine &TM; 00089 const XCoreSubtarget &Subtarget; 00090 00091 // Lower Operand helpers 00092 SDValue LowerCCCArguments(SDValue Op, SelectionDAG &DAG); 00093 SDValue LowerCCCCallTo(SDValue Op, SelectionDAG &DAG, unsigned CC); 00094 SDNode *LowerCallResult(SDValue Chain, SDValue InFlag, CallSDNode*TheCall, 00095 unsigned CallingConv, SelectionDAG &DAG); 00096 SDValue getReturnAddressFrameIndex(SelectionDAG &DAG); 00097 SDValue getGlobalAddressWrapper(SDValue GA, GlobalValue *GV, 00098 SelectionDAG &DAG); 00099 00100 // Lower Operand specifics 00101 SDValue LowerRET(SDValue Op, SelectionDAG &DAG); 00102 SDValue LowerCALL(SDValue Op, SelectionDAG &DAG); 00103 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG); 00104 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG); 00105 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG); 00106 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG); 00107 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG); 00108 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG); 00109 SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG); 00110 SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG); 00111 SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG); 00112 00113 // Inline asm support 00114 std::vector<unsigned> 00115 getRegClassForInlineAsmConstraint(const std::string &Constraint, 00116 MVT VT) const; 00117 00118 // Expand specifics 00119 SDValue ExpandADDSUB(SDNode *Op, SelectionDAG &DAG); 00120 }; 00121 } 00122 00123 #endif // XCOREISELLOWERING_H