LLVM API Documentation

AlphaISelLowering.h

Go to the documentation of this file.
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     bool useITOF;
00066   public:
00067     explicit AlphaTargetLowering(TargetMachine &TM);
00068     
00069     /// getSetCCResultType - Get the SETCC result ValueType
00070     virtual MVT getSetCCResultType(MVT VT) const;
00071 
00072     /// LowerOperation - Provide custom lowering hooks for some operations.
00073     ///
00074     virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
00075 
00076     /// ReplaceNodeResults - Replace the results of node with an illegal result
00077     /// type with new values built out of custom code.
00078     ///
00079     virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
00080                                     SelectionDAG &DAG);
00081 
00082     // Friendly names for dumps
00083     const char *getTargetNodeName(unsigned Opcode) const;
00084 
00085     /// LowerCallTo - This hook lowers an abstract call to a function into an
00086     /// actual call.
00087     virtual std::pair<SDValue, SDValue>
00088     LowerCallTo(SDValue Chain, const Type *RetTy, bool RetSExt, bool RetZExt,
00089                 bool isVarArg, bool isInreg, unsigned CC, bool isTailCall, 
00090                 SDValue Callee, ArgListTy &Args, SelectionDAG &DAG, 
00091                 DebugLoc dl);
00092 
00093     ConstraintType getConstraintType(const std::string &Constraint) const;
00094 
00095     std::vector<unsigned> 
00096       getRegClassForInlineAsmConstraint(const std::string &Constraint,
00097                                         MVT VT) const;
00098 
00099     bool hasITOF() { return useITOF; }
00100 
00101     MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
00102                                                    MachineBasicBlock *BB);
00103 
00104     virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
00105 
00106   private:
00107     // Helpers for custom lowering.
00108     void LowerVAARG(SDNode *N, SDValue &Chain, SDValue &DataPtr,
00109                     SelectionDAG &DAG);
00110 
00111   };
00112 }
00113 
00114 #endif   // LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H