LLVM API Documentation
00001 //==-- SystemZISelLowering.h - SystemZ 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 SystemZ uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_TARGET_SystemZ_ISELLOWERING_H 00016 #define LLVM_TARGET_SystemZ_ISELLOWERING_H 00017 00018 #include "SystemZ.h" 00019 #include "SystemZRegisterInfo.h" 00020 #include "llvm/CodeGen/SelectionDAG.h" 00021 #include "llvm/Target/TargetLowering.h" 00022 00023 namespace llvm { 00024 namespace SystemZISD { 00025 enum { 00026 FIRST_NUMBER = ISD::BUILTIN_OP_END, 00027 00028 /// Return with a flag operand. Operand 0 is the chain operand. 00029 RET_FLAG, 00030 00031 /// CALL - These operations represent an abstract call 00032 /// instruction, which includes a bunch of information. 00033 CALL, 00034 00035 /// PCRelativeWrapper - PC relative address 00036 PCRelativeWrapper, 00037 00038 /// CMP, UCMP - Compare instruction 00039 CMP, 00040 UCMP, 00041 00042 /// BRCOND - Conditional branch. Operand 0 is chain operand, operand 1 is 00043 /// the block to branch if condition is true, operand 2 is condition code 00044 /// and operand 3 is the flag operand produced by a CMP instruction. 00045 BRCOND, 00046 00047 /// SELECT - Operands 0 and 1 are selection variables, operand 2 is 00048 /// condition code and operand 3 is the flag operand. 00049 SELECT 00050 }; 00051 } 00052 00053 class SystemZSubtarget; 00054 class SystemZTargetMachine; 00055 00056 class SystemZTargetLowering : public TargetLowering { 00057 public: 00058 explicit SystemZTargetLowering(SystemZTargetMachine &TM); 00059 00060 /// LowerOperation - Provide custom lowering hooks for some operations. 00061 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00062 00063 /// getTargetNodeName - This method returns the name of a target specific 00064 /// DAG node. 00065 virtual const char *getTargetNodeName(unsigned Opcode) const; 00066 00067 /// getFunctionAlignment - Return the Log2 alignment of this function. 00068 virtual unsigned getFunctionAlignment(const Function *F) const { 00069 return 1; 00070 } 00071 00072 std::pair<unsigned, const TargetRegisterClass*> 00073 getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; 00074 TargetLowering::ConstraintType 00075 getConstraintType(const std::string &Constraint) const; 00076 00077 SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG); 00078 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG); 00079 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG); 00080 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG); 00081 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG); 00082 00083 SDValue EmitCmp(SDValue LHS, SDValue RHS, 00084 ISD::CondCode CC, SDValue &SystemZCC, 00085 SelectionDAG &DAG); 00086 00087 00088 MachineBasicBlock* EmitInstrWithCustomInserter(MachineInstr *MI, 00089 MachineBasicBlock *BB) const; 00090 00091 private: 00092 SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee, 00093 unsigned CallConv, bool isVarArg, 00094 bool isTailCall, 00095 const SmallVectorImpl<ISD::OutputArg> &Outs, 00096 const SmallVectorImpl<ISD::InputArg> &Ins, 00097 DebugLoc dl, SelectionDAG &DAG, 00098 SmallVectorImpl<SDValue> &InVals); 00099 00100 SDValue LowerCCCArguments(SDValue Chain, 00101 unsigned CallConv, 00102 bool isVarArg, 00103 const SmallVectorImpl<ISD::InputArg> &Ins, 00104 DebugLoc dl, 00105 SelectionDAG &DAG, 00106 SmallVectorImpl<SDValue> &InVals); 00107 00108 SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 00109 unsigned CallConv, bool isVarArg, 00110 const SmallVectorImpl<ISD::InputArg> &Ins, 00111 DebugLoc dl, SelectionDAG &DAG, 00112 SmallVectorImpl<SDValue> &InVals); 00113 00114 virtual SDValue 00115 LowerFormalArguments(SDValue Chain, 00116 unsigned CallConv, bool isVarArg, 00117 const SmallVectorImpl<ISD::InputArg> &Ins, 00118 DebugLoc dl, SelectionDAG &DAG, 00119 SmallVectorImpl<SDValue> &InVals); 00120 virtual SDValue 00121 LowerCall(SDValue Chain, SDValue Callee, 00122 unsigned CallConv, bool isVarArg, bool isTailCall, 00123 const SmallVectorImpl<ISD::OutputArg> &Outs, 00124 const SmallVectorImpl<ISD::InputArg> &Ins, 00125 DebugLoc dl, SelectionDAG &DAG, 00126 SmallVectorImpl<SDValue> &InVals); 00127 00128 virtual SDValue 00129 LowerReturn(SDValue Chain, 00130 unsigned CallConv, bool isVarArg, 00131 const SmallVectorImpl<ISD::OutputArg> &Outs, 00132 DebugLoc dl, SelectionDAG &DAG); 00133 00134 const SystemZSubtarget &Subtarget; 00135 const SystemZTargetMachine &TM; 00136 const SystemZRegisterInfo *RegInfo; 00137 }; 00138 } // namespace llvm 00139 00140 #endif // LLVM_TARGET_SystemZ_ISELLOWERING_H