LLVM API Documentation
00001 //==-- MSP430ISelLowering.h - MSP430 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 MSP430 uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_TARGET_MSP430_ISELLOWERING_H 00016 #define LLVM_TARGET_MSP430_ISELLOWERING_H 00017 00018 #include "MSP430.h" 00019 #include "llvm/CodeGen/SelectionDAG.h" 00020 #include "llvm/Target/TargetLowering.h" 00021 00022 namespace llvm { 00023 namespace MSP430ISD { 00024 enum { 00025 FIRST_NUMBER = ISD::BUILTIN_OP_END, 00026 00027 /// Return with a flag operand. Operand 0 is the chain operand. 00028 RET_FLAG, 00029 00030 /// Y = R{R,L}A X, rotate right (left) arithmetically 00031 RRA, RLA, 00032 00033 /// Y = RRC X, rotate right via carry 00034 RRC, 00035 00036 /// CALL - These operations represent an abstract call 00037 /// instruction, which includes a bunch of information. 00038 CALL, 00039 00040 /// Wrapper - A wrapper node for TargetConstantPool, TargetExternalSymbol, 00041 /// and TargetGlobalAddress. 00042 Wrapper, 00043 00044 /// CMP - Compare instruction. 00045 CMP, 00046 00047 /// SetCC. Operand 0 is condition code, and operand 1 is the flag 00048 /// operand produced by a CMP instruction. 00049 SETCC, 00050 00051 /// MSP430 conditional branches. Operand 0 is the chain operand, operand 1 00052 /// is the block to branch if condition is true, operand 2 is the 00053 /// condition code, and operand 3 is the flag operand produced by a CMP 00054 /// instruction. 00055 BR_CC, 00056 00057 /// SELECT_CC. Operand 0 and operand 1 are selection variable, operand 3 00058 /// is condition code and operand 4 is flag operand. 00059 SELECT_CC 00060 }; 00061 } 00062 00063 class MSP430Subtarget; 00064 class MSP430TargetMachine; 00065 00066 class MSP430TargetLowering : public TargetLowering { 00067 public: 00068 explicit MSP430TargetLowering(MSP430TargetMachine &TM); 00069 00070 /// LowerOperation - Provide custom lowering hooks for some operations. 00071 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00072 00073 /// getTargetNodeName - This method returns the name of a target specific 00074 /// DAG node. 00075 virtual const char *getTargetNodeName(unsigned Opcode) const; 00076 00077 /// getFunctionAlignment - Return the Log2 alignment of this function. 00078 virtual unsigned getFunctionAlignment(const Function *F) const; 00079 00080 SDValue LowerShifts(SDValue Op, SelectionDAG &DAG); 00081 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG); 00082 SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG); 00083 SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG); 00084 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG); 00085 SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG); 00086 00087 MachineBasicBlock* EmitInstrWithCustomInserter(MachineInstr *MI, 00088 MachineBasicBlock *BB) const; 00089 00090 private: 00091 SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee, 00092 unsigned CallConv, bool isVarArg, 00093 bool isTailCall, 00094 const SmallVectorImpl<ISD::OutputArg> &Outs, 00095 const SmallVectorImpl<ISD::InputArg> &Ins, 00096 DebugLoc dl, SelectionDAG &DAG, 00097 SmallVectorImpl<SDValue> &InVals); 00098 00099 SDValue LowerCCCArguments(SDValue Chain, 00100 unsigned CallConv, 00101 bool isVarArg, 00102 const SmallVectorImpl<ISD::InputArg> &Ins, 00103 DebugLoc dl, 00104 SelectionDAG &DAG, 00105 SmallVectorImpl<SDValue> &InVals); 00106 00107 SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 00108 unsigned CallConv, bool isVarArg, 00109 const SmallVectorImpl<ISD::InputArg> &Ins, 00110 DebugLoc dl, SelectionDAG &DAG, 00111 SmallVectorImpl<SDValue> &InVals); 00112 00113 virtual SDValue 00114 LowerFormalArguments(SDValue Chain, 00115 unsigned CallConv, bool isVarArg, 00116 const SmallVectorImpl<ISD::InputArg> &Ins, 00117 DebugLoc dl, SelectionDAG &DAG, 00118 SmallVectorImpl<SDValue> &InVals); 00119 virtual SDValue 00120 LowerCall(SDValue Chain, SDValue Callee, 00121 unsigned CallConv, bool isVarArg, bool isTailCall, 00122 const SmallVectorImpl<ISD::OutputArg> &Outs, 00123 const SmallVectorImpl<ISD::InputArg> &Ins, 00124 DebugLoc dl, SelectionDAG &DAG, 00125 SmallVectorImpl<SDValue> &InVals); 00126 00127 virtual SDValue 00128 LowerReturn(SDValue Chain, 00129 unsigned CallConv, bool isVarArg, 00130 const SmallVectorImpl<ISD::OutputArg> &Outs, 00131 DebugLoc dl, SelectionDAG &DAG); 00132 00133 const MSP430Subtarget &Subtarget; 00134 const MSP430TargetMachine &TM; 00135 }; 00136 } // namespace llvm 00137 00138 #endif // LLVM_TARGET_MSP430_ISELLOWERING_H