LLVM API Documentation
00001 //===-- AlphaISelLowering.h - Alpha 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 Alpha uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H 00016 #define LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H 00017 00018 #include "llvm/ADT/VectorExtras.h" 00019 #include "llvm/Target/TargetLowering.h" 00020 #include "llvm/CodeGen/SelectionDAG.h" 00021 #include "Alpha.h" 00022 00023 namespace llvm { 00024 00025 namespace AlphaISD { 00026 enum NodeType { 00027 // Start the numbering where the builting ops and target ops leave off. 00028 FIRST_NUMBER = ISD::BUILTIN_OP_END, 00029 //These corrospond to the identical Instruction 00030 CVTQT_, CVTQS_, CVTTQ_, 00031 00032 /// GPRelHi/GPRelLo - These represent the high and low 16-bit 00033 /// parts of a global address respectively. 00034 GPRelHi, GPRelLo, 00035 00036 /// RetLit - Literal Relocation of a Global 00037 RelLit, 00038 00039 /// GlobalRetAddr - used to restore the return address 00040 GlobalRetAddr, 00041 00042 /// CALL - Normal call. 00043 CALL, 00044 00045 /// DIVCALL - used for special library calls for div and rem 00046 DivCall, 00047 00048 /// return flag operand 00049 RET_FLAG, 00050 00051 /// CHAIN = COND_BRANCH CHAIN, OPC, (G|F)PRC, DESTBB [, INFLAG] - This 00052 /// corresponds to the COND_BRANCH pseudo instruction. 00053 /// *PRC is the input register to compare to zero, 00054 /// OPC is the branch opcode to use (e.g. Alpha::BEQ), 00055 /// DESTBB is the destination block to branch to, and INFLAG is 00056 /// an optional input flag argument. 00057 COND_BRANCH_I, COND_BRANCH_F 00058 00059 }; 00060 } 00061 00062 class AlphaTargetLowering : public TargetLowering { 00063 int VarArgsOffset; // What is the offset to the first vaarg 00064 int VarArgsBase; // What is the base FrameIndex 00065 public: 00066 explicit AlphaTargetLowering(TargetMachine &TM); 00067 00068 /// getSetCCResultType - Get the SETCC result ValueType 00069 virtual MVT::SimpleValueType getSetCCResultType(EVT VT) const; 00070 00071 /// LowerOperation - Provide custom lowering hooks for some operations. 00072 /// 00073 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00074 00075 /// ReplaceNodeResults - Replace the results of node with an illegal result 00076 /// type with new values built out of custom code. 00077 /// 00078 virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, 00079 SelectionDAG &DAG); 00080 00081 // Friendly names for dumps 00082 const char *getTargetNodeName(unsigned Opcode) const; 00083 00084 SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 00085 unsigned CallConv, bool isVarArg, 00086 const SmallVectorImpl<ISD::InputArg> &Ins, 00087 DebugLoc dl, SelectionDAG &DAG, 00088 SmallVectorImpl<SDValue> &InVals); 00089 00090 ConstraintType getConstraintType(const std::string &Constraint) const; 00091 00092 std::vector<unsigned> 00093 getRegClassForInlineAsmConstraint(const std::string &Constraint, 00094 EVT VT) const; 00095 00096 MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, 00097 MachineBasicBlock *BB) const; 00098 00099 virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; 00100 00101 /// getFunctionAlignment - Return the Log2 alignment of this function. 00102 virtual unsigned getFunctionAlignment(const Function *F) const; 00103 00104 private: 00105 // Helpers for custom lowering. 00106 void LowerVAARG(SDNode *N, SDValue &Chain, SDValue &DataPtr, 00107 SelectionDAG &DAG); 00108 00109 virtual SDValue 00110 LowerFormalArguments(SDValue Chain, 00111 unsigned CallConv, bool isVarArg, 00112 const SmallVectorImpl<ISD::InputArg> &Ins, 00113 DebugLoc dl, SelectionDAG &DAG, 00114 SmallVectorImpl<SDValue> &InVals); 00115 00116 virtual SDValue 00117 LowerCall(SDValue Chain, SDValue Callee, 00118 unsigned CallConv, bool isVarArg, bool isTailCall, 00119 const SmallVectorImpl<ISD::OutputArg> &Outs, 00120 const SmallVectorImpl<ISD::InputArg> &Ins, 00121 DebugLoc dl, SelectionDAG &DAG, 00122 SmallVectorImpl<SDValue> &InVals); 00123 00124 virtual SDValue 00125 LowerReturn(SDValue Chain, 00126 unsigned CallConv, bool isVarArg, 00127 const SmallVectorImpl<ISD::OutputArg> &Outs, 00128 DebugLoc dl, SelectionDAG &DAG); 00129 }; 00130 } 00131 00132 #endif // LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H