LLVM API Documentation
00001 //===-- SparcISelLowering.h - Sparc 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 Sparc uses to lower LLVM code into a 00011 // selection DAG. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef SPARC_ISELLOWERING_H 00016 #define SPARC_ISELLOWERING_H 00017 00018 #include "llvm/Target/TargetLowering.h" 00019 #include "Sparc.h" 00020 00021 namespace llvm { 00022 namespace SPISD { 00023 enum { 00024 FIRST_NUMBER = ISD::BUILTIN_OP_END, 00025 CMPICC, // Compare two GPR operands, set icc. 00026 CMPFCC, // Compare two FP operands, set fcc. 00027 BRICC, // Branch to dest on icc condition 00028 BRFCC, // Branch to dest on fcc condition 00029 SELECT_ICC, // Select between two values using the current ICC flags. 00030 SELECT_FCC, // Select between two values using the current FCC flags. 00031 00032 Hi, Lo, // Hi/Lo operations, typically on a global address. 00033 00034 FTOI, // FP to Int within a FP register. 00035 ITOF, // Int to FP within a FP register. 00036 00037 CALL, // A call instruction. 00038 RET_FLAG // Return with a flag operand. 00039 }; 00040 } 00041 00042 class SparcTargetLowering : public TargetLowering { 00043 int VarArgsFrameOffset; // Frame offset to start of varargs area. 00044 public: 00045 SparcTargetLowering(TargetMachine &TM); 00046 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG); 00047 00048 int getVarArgsFrameOffset() const { return VarArgsFrameOffset; } 00049 00050 /// computeMaskedBitsForTargetNode - Determine which of the bits specified 00051 /// in Mask are known to be either zero or one and return them in the 00052 /// KnownZero/KnownOne bitsets. 00053 virtual void computeMaskedBitsForTargetNode(const SDValue Op, 00054 const APInt &Mask, 00055 APInt &KnownZero, 00056 APInt &KnownOne, 00057 const SelectionDAG &DAG, 00058 unsigned Depth = 0) const; 00059 00060 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, 00061 MachineBasicBlock *MBB) const; 00062 00063 virtual const char *getTargetNodeName(unsigned Opcode) const; 00064 00065 ConstraintType getConstraintType(const std::string &Constraint) const; 00066 std::pair<unsigned, const TargetRegisterClass*> 00067 getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; 00068 std::vector<unsigned> 00069 getRegClassForInlineAsmConstraint(const std::string &Constraint, 00070 EVT VT) const; 00071 00072 virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const; 00073 00074 /// getFunctionAlignment - Return the Log2 alignment of this function. 00075 virtual unsigned getFunctionAlignment(const Function *F) const; 00076 00077 virtual SDValue 00078 LowerFormalArguments(SDValue Chain, 00079 unsigned CallConv, 00080 bool isVarArg, 00081 const SmallVectorImpl<ISD::InputArg> &Ins, 00082 DebugLoc dl, SelectionDAG &DAG, 00083 SmallVectorImpl<SDValue> &InVals); 00084 00085 virtual SDValue 00086 LowerCall(SDValue Chain, SDValue Callee, 00087 unsigned CallConv, bool isVarArg, 00088 bool isTailCall, 00089 const SmallVectorImpl<ISD::OutputArg> &Outs, 00090 const SmallVectorImpl<ISD::InputArg> &Ins, 00091 DebugLoc dl, SelectionDAG &DAG, 00092 SmallVectorImpl<SDValue> &InVals); 00093 00094 virtual SDValue 00095 LowerReturn(SDValue Chain, 00096 unsigned CallConv, bool isVarArg, 00097 const SmallVectorImpl<ISD::OutputArg> &Outs, 00098 DebugLoc dl, SelectionDAG &DAG); 00099 }; 00100 } // end namespace llvm 00101 00102 #endif // SPARC_ISELLOWERING_H