LLVM API Documentation

SparcISelLowering.h

Go to the documentation of this file.
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 void LowerArguments(Function &F, SelectionDAG &DAG,
00061                                 SmallVectorImpl<SDValue> &ArgValues,
00062                                 DebugLoc dl);
00063     virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
00064                                                         MachineBasicBlock *MBB);
00065 
00066     virtual const char *getTargetNodeName(unsigned Opcode) const;
00067 
00068     ConstraintType getConstraintType(const std::string &Constraint) const;
00069     std::pair<unsigned, const TargetRegisterClass*>
00070     getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const;
00071     std::vector<unsigned>
00072     getRegClassForInlineAsmConstraint(const std::string &Constraint,
00073                                       MVT VT) const;
00074 
00075     virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
00076   };
00077 } // end namespace llvm
00078 
00079 #endif    // SPARC_ISELLOWERING_H