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 was developed by Andrew Lenharth and is distributed under
00006 // the University of Illinois Open Source 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/Target/TargetLowering.h"
00019 #include "llvm/CodeGen/SelectionDAG.h"
00020 #include "Alpha.h"
00021 
00022 namespace llvm {
00023 
00024   namespace AlphaISD {
00025     enum NodeType {
00026       // Start the numbering where the builting ops and target ops leave off.
00027       FIRST_NUMBER = ISD::BUILTIN_OP_END+Alpha::INSTRUCTION_LIST_END,
00028       //These corrospond to the identical Instruction
00029       ITOFT_, FTOIT_, CVTQT_, CVTQS_, CVTTQ_,
00030 
00031       /// GPRelHi/GPRelLo - These represent the high and low 16-bit
00032       /// parts of a global address respectively.
00033       GPRelHi, GPRelLo, 
00034 
00035       /// RetLit - Literal Relocation of a Global
00036       RelLit,
00037 
00038       /// GlobalBaseReg - used to restore the GOT ptr
00039       GlobalBaseReg,
00040       
00041       /// CALL - Normal call.
00042       CALL,
00043 
00044       /// DIVCALL - used for special library calls for div and rem
00045       DivCall,
00046 
00047     };
00048   }
00049 
00050   class AlphaTargetLowering : public TargetLowering {
00051     int VarArgsOffset;  // What is the offset to the first vaarg
00052     int VarArgsBase;    // What is the base FrameIndex
00053     unsigned GP; //GOT vreg
00054     unsigned RA; //Return Address
00055     bool useITOF;
00056   public:
00057     AlphaTargetLowering(TargetMachine &TM);
00058     
00059     /// LowerOperation - Provide custom lowering hooks for some operations.
00060     ///
00061     virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
00062     virtual SDOperand CustomPromoteOperation(SDOperand Op, SelectionDAG &DAG);
00063 
00064     //Friendly names for dumps
00065     const char *getTargetNodeName(unsigned Opcode) const;
00066 
00067     /// LowerArguments - This hook must be implemented to indicate how we should
00068     /// lower the arguments for the specified function, into the specified DAG.
00069     virtual std::vector<SDOperand>
00070     LowerArguments(Function &F, SelectionDAG &DAG);
00071 
00072     /// LowerCallTo - This hook lowers an abstract call to a function into an
00073     /// actual call.
00074     virtual std::pair<SDOperand, SDOperand>
00075     LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg, unsigned CC,
00076                 bool isTailCall, SDOperand Callee, ArgListTy &Args,
00077                 SelectionDAG &DAG);
00078 
00079     void restoreGP(MachineBasicBlock* BB);
00080     void restoreRA(MachineBasicBlock* BB);
00081     unsigned getVRegGP() { return GP; }
00082     unsigned getVRegRA() { return RA; }
00083     bool hasITOF() { return useITOF; }
00084   };
00085 }
00086 
00087 #endif   // LLVM_TARGET_ALPHA_ALPHAISELLOWERING_H