LLVM API Documentation

AlphaISelDAGToDAG.cpp

Go to the documentation of this file.
00001 //===-- AlphaISelDAGToDAG.cpp - Alpha pattern matching inst selector ------===//
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 a pattern matching instruction selector for Alpha,
00011 // converting from a legalized dag to a Alpha dag.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #include "Alpha.h"
00016 #include "AlphaTargetMachine.h"
00017 #include "AlphaISelLowering.h"
00018 #include "llvm/CodeGen/MachineInstrBuilder.h"
00019 #include "llvm/CodeGen/MachineFrameInfo.h"
00020 #include "llvm/CodeGen/MachineFunction.h"
00021 #include "llvm/CodeGen/MachineRegisterInfo.h"
00022 #include "llvm/CodeGen/SelectionDAG.h"
00023 #include "llvm/CodeGen/SelectionDAGISel.h"
00024 #include "llvm/Target/TargetOptions.h"
00025 #include "llvm/Constants.h"
00026 #include "llvm/DerivedTypes.h"
00027 #include "llvm/GlobalValue.h"
00028 #include "llvm/Intrinsics.h"
00029 #include "llvm/Support/Compiler.h"
00030 #include "llvm/Support/Debug.h"
00031 #include "llvm/Support/MathExtras.h"
00032 #include <algorithm>
00033 using namespace llvm;
00034 
00035 namespace {
00036 
00037   //===--------------------------------------------------------------------===//
00038   /// AlphaDAGToDAGISel - Alpha specific code to select Alpha machine
00039   /// instructions for SelectionDAG operations.
00040   class AlphaDAGToDAGISel : public SelectionDAGISel {
00041     static const int64_t IMM_LOW  = -32768;
00042     static const int64_t IMM_HIGH = 32767;
00043     static const int64_t IMM_MULT = 65536;
00044     static const int64_t IMM_FULLHIGH = IMM_HIGH + IMM_HIGH * IMM_MULT;
00045     static const int64_t IMM_FULLLOW = IMM_LOW + IMM_LOW  * IMM_MULT;
00046 
00047     static int64_t get_ldah16(int64_t x) {
00048       int64_t y = x / IMM_MULT;
00049       if (x % IMM_MULT > IMM_HIGH)
00050         ++y;
00051       return y;
00052     }
00053 
00054     static int64_t get_lda16(int64_t x) {
00055       return x - get_ldah16(x) * IMM_MULT;
00056     }
00057 
00058     /// get_zapImm - Return a zap mask if X is a valid immediate for a zapnot
00059     /// instruction (if not, return 0).  Note that this code accepts partial
00060     /// zap masks.  For example (and LHS, 1) is a valid zap, as long we know
00061     /// that the bits 1-7 of LHS are already zero.  If LHS is non-null, we are
00062     /// in checking mode.  If LHS is null, we assume that the mask has already
00063     /// been validated before.
00064     uint64_t get_zapImm(SDValue LHS, uint64_t Constant) {
00065       uint64_t BitsToCheck = 0;
00066       unsigned Result = 0;
00067       for (unsigned i = 0; i != 8; ++i) {
00068         if (((Constant >> 8*i) & 0xFF) == 0) {
00069           // nothing to do.
00070         } else {
00071           Result |= 1 << i;
00072           if (((Constant >> 8*i) & 0xFF) == 0xFF) {
00073             // If the entire byte is set, zapnot the byte.
00074           } else if (LHS.getNode() == 0) {
00075             // Otherwise, if the mask was previously validated, we know its okay
00076             // to zapnot this entire byte even though all the bits aren't set.
00077           } else {
00078             // Otherwise we don't know that the it's okay to zapnot this entire
00079             // byte.  Only do this iff we can prove that the missing bits are
00080             // already null, so the bytezap doesn't need to really null them.
00081             BitsToCheck |= ~Constant & (0xFF << 8*i);
00082           }
00083         }
00084       }
00085       
00086       // If there are missing bits in a byte (for example, X & 0xEF00), check to
00087       // see if the missing bits (0x1000) are already known zero if not, the zap
00088       // isn't okay to do, as it won't clear all the required bits.
00089       if (BitsToCheck &&
00090           !CurDAG->MaskedValueIsZero(LHS,
00091                                      APInt(LHS.getValueSizeInBits(),
00092                                            BitsToCheck)))
00093         return 0;
00094       
00095       return Result;
00096     }
00097     
00098     static uint64_t get_zapImm(uint64_t x) {
00099       unsigned build = 0;
00100       for(int i = 0; i != 8; ++i) {
00101         if ((x & 0x00FF) == 0x00FF)
00102           build |= 1 << i;
00103         else if ((x & 0x00FF) != 0)
00104           return 0;
00105         x >>= 8;
00106       }
00107       return build;
00108     }
00109       
00110     
00111     static uint64_t getNearPower2(uint64_t x) {
00112       if (!x) return 0;
00113       unsigned at = CountLeadingZeros_64(x);
00114       uint64_t complow = 1 << (63 - at);
00115       uint64_t comphigh = 1 << (64 - at);
00116       //cerr << x << ":" << complow << ":" << comphigh << "\n";
00117       if (abs(complow - x) <= abs(comphigh - x))
00118         return complow;
00119       else
00120         return comphigh;
00121     }
00122 
00123     static bool chkRemNearPower2(uint64_t x, uint64_t r, bool swap) {
00124       uint64_t y = getNearPower2(x);
00125       if (swap)
00126         return (y - x) == r;
00127       else
00128         return (x - y) == r;
00129     }
00130 
00131     static bool isFPZ(SDValue N) {
00132       ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(N);
00133       return (CN && (CN->getValueAPF().isZero()));
00134     }
00135     static bool isFPZn(SDValue N) {
00136       ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(N);
00137       return (CN && CN->getValueAPF().isNegZero());
00138     }
00139     static bool isFPZp(SDValue N) {
00140       ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(N);
00141       return (CN && CN->getValueAPF().isPosZero());
00142     }
00143 
00144   public:
00145     explicit AlphaDAGToDAGISel(AlphaTargetMachine &TM)
00146       : SelectionDAGISel(TM)
00147     {}
00148 
00149     /// getI64Imm - Return a target constant with the specified value, of type
00150     /// i64.
00151     inline SDValue getI64Imm(int64_t Imm) {
00152       return CurDAG->getTargetConstant(Imm, MVT::i64);
00153     }
00154 
00155     // Select - Convert the specified operand from a target-independent to a
00156     // target-specific node if it hasn't already been changed.
00157     SDNode *Select(SDValue Op);
00158     
00159     /// InstructionSelect - This callback is invoked by
00160     /// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
00161     virtual void InstructionSelect();
00162     
00163     virtual const char *getPassName() const {
00164       return "Alpha DAG->DAG Pattern Instruction Selection";
00165     } 
00166 
00167     /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for
00168     /// inline asm expressions.
00169     virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op,
00170                                               char ConstraintCode,
00171                                               std::vector<SDValue> &OutOps) {
00172       SDValue Op0;
00173       switch (ConstraintCode) {
00174       default: return true;
00175       case 'm':   // memory
00176         Op0 = Op;
00177         break;
00178       }
00179       
00180       OutOps.push_back(Op0);
00181       return false;
00182     }
00183     
00184 // Include the pieces autogenerated from the target description.
00185 #include "AlphaGenDAGISel.inc"
00186     
00187 private:
00188     SDValue getGlobalBaseReg();
00189     SDValue getGlobalRetAddr();
00190     void SelectCALL(SDValue Op);
00191 
00192   };
00193 }
00194 
00195 /// getGlobalBaseReg - Output the instructions required to put the
00196 /// GOT address into a register.
00197 ///
00198 SDValue AlphaDAGToDAGISel::getGlobalBaseReg() {
00199   unsigned GP = 0;
00200   for(MachineRegisterInfo::livein_iterator ii = RegInfo->livein_begin(), 
00201         ee = RegInfo->livein_end(); ii != ee; ++ii)
00202     if (ii->first == Alpha::R29) {
00203       GP = ii->second;
00204       break;
00205     }
00206   assert(GP && "GOT PTR not in liveins");
00207   return CurDAG->getCopyFromReg(CurDAG->getEntryNode(), 
00208                                 GP, MVT::i64);
00209 }
00210 
00211 /// getRASaveReg - Grab the return address
00212 ///
00213 SDValue AlphaDAGToDAGISel::getGlobalRetAddr() {
00214   unsigned RA = 0;
00215   for(MachineRegisterInfo::livein_iterator ii = RegInfo->livein_begin(), 
00216         ee = RegInfo->livein_end(); ii != ee; ++ii)
00217     if (ii->first == Alpha::R26) {
00218       RA = ii->second;
00219       break;
00220     }
00221   assert(RA && "RA PTR not in liveins");
00222   return CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
00223                                 RA, MVT::i64);
00224 }
00225 
00226 /// InstructionSelect - This callback is invoked by
00227 /// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
00228 void AlphaDAGToDAGISel::InstructionSelect() {
00229   DEBUG(BB->dump());
00230   
00231   // Select target instructions for the DAG.
00232   SelectRoot(*CurDAG);
00233   CurDAG->RemoveDeadNodes();
00234 }
00235 
00236 // Select - Convert the specified operand from a target-independent to a
00237 // target-specific node if it hasn't already been changed.
00238 SDNode *AlphaDAGToDAGISel::Select(SDValue Op) {
00239   SDNode *N = Op.getNode();
00240   if (N->isMachineOpcode()) {
00241     return NULL;   // Already selected.
00242   }
00243 
00244   switch (N->getOpcode()) {
00245   default: break;
00246   case AlphaISD::CALL:
00247     SelectCALL(Op);
00248     return NULL;
00249 
00250   case ISD::FrameIndex: {
00251     int FI = cast<FrameIndexSDNode>(N)->getIndex();
00252     return CurDAG->SelectNodeTo(N, Alpha::LDA, MVT::i64,
00253                                 CurDAG->getTargetFrameIndex(FI, MVT::i32),
00254                                 getI64Imm(0));
00255   }
00256   case ISD::GLOBAL_OFFSET_TABLE: {
00257     SDValue Result = getGlobalBaseReg();
00258     ReplaceUses(Op, Result);
00259     return NULL;
00260   }
00261   case AlphaISD::GlobalRetAddr: {
00262     SDValue Result = getGlobalRetAddr();
00263     ReplaceUses(Op, Result);
00264     return NULL;
00265   }
00266   
00267   case AlphaISD::DivCall: {
00268     SDValue Chain = CurDAG->getEntryNode();
00269     SDValue N0 = Op.getOperand(0);
00270     SDValue N1 = Op.getOperand(1);
00271     SDValue N2 = Op.getOperand(2);
00272     Chain = CurDAG->getCopyToReg(Chain, Alpha::R24, N1, 
00273                                  SDValue(0,0));
00274     Chain = CurDAG->getCopyToReg(Chain, Alpha::R25, N2, 
00275                                  Chain.getValue(1));
00276     Chain = CurDAG->getCopyToReg(Chain, Alpha::R27, N0, 
00277                                  Chain.getValue(1));
00278     SDNode *CNode =
00279       CurDAG->getTargetNode(Alpha::JSRs, MVT::Other, MVT::Flag, 
00280                             Chain, Chain.getValue(1));
00281     Chain = CurDAG->getCopyFromReg(Chain, Alpha::R27, MVT::i64, 
00282                                    SDValue(CNode, 1));
00283     return CurDAG->SelectNodeTo(N, Alpha::BISr, MVT::i64, Chain, Chain);
00284   }
00285 
00286   case ISD::READCYCLECOUNTER: {
00287     SDValue Chain = N->getOperand(0);
00288     return CurDAG->getTargetNode(Alpha::RPCC, MVT::i64, MVT::Other,
00289                                  Chain);
00290   }
00291 
00292   case ISD::Constant: {
00293     uint64_t uval = cast<ConstantSDNode>(N)->getZExtValue();
00294     
00295     if (uval == 0) {
00296       SDValue Result = CurDAG->getCopyFromReg(CurDAG->getEntryNode(),
00297                                                 Alpha::R31, MVT::i64);
00298       ReplaceUses(Op, Result);
00299       return NULL;
00300     }
00301 
00302     int64_t val = (int64_t)uval;
00303     int32_t val32 = (int32_t)val;
00304     if (val <= IMM_HIGH + IMM_HIGH * IMM_MULT &&
00305         val >= IMM_LOW  + IMM_LOW  * IMM_MULT)
00306       break; //(LDAH (LDA))
00307     if ((uval >> 32) == 0 && //empty upper bits
00308         val32 <= IMM_HIGH + IMM_HIGH * IMM_MULT)
00309       // val32 >= IMM_LOW  + IMM_LOW  * IMM_MULT) //always true
00310       break; //(zext (LDAH (LDA)))
00311     //Else use the constant pool
00312     ConstantInt *C = ConstantInt::get(Type::Int64Ty, uval);
00313     SDValue CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
00314     SDNode *Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI,
00315                                         getGlobalBaseReg());
00316     return CurDAG->SelectNodeTo(N, Alpha::LDQr, MVT::i64, MVT::Other, 
00317                                 CPI, SDValue(Tmp, 0), CurDAG->getEntryNode());
00318   }
00319   case ISD::TargetConstantFP:
00320   case ISD::ConstantFP: {
00321     ConstantFPSDNode *CN = cast<ConstantFPSDNode>(N);
00322     bool isDouble = N->getValueType(0) == MVT::f64;
00323     MVT T = isDouble ? MVT::f64 : MVT::f32;
00324     if (CN->getValueAPF().isPosZero()) {
00325       return CurDAG->SelectNodeTo(N, isDouble ? Alpha::CPYST : Alpha::CPYSS,
00326                                   T, CurDAG->getRegister(Alpha::F31, T),
00327                                   CurDAG->getRegister(Alpha::F31, T));
00328     } else if (CN->getValueAPF().isNegZero()) {
00329       return CurDAG->SelectNodeTo(N, isDouble ? Alpha::CPYSNT : Alpha::CPYSNS,
00330                                   T, CurDAG->getRegister(Alpha::F31, T),
00331                                   CurDAG->getRegister(Alpha::F31, T));
00332     } else {
00333       abort();
00334     }
00335     break;
00336   }
00337 
00338   case ISD::SETCC:
00339     if (N->getOperand(0).getNode()->getValueType(0).isFloatingPoint()) {
00340       ISD::CondCode CC = cast<CondCodeSDNode>(N->getOperand(2))->get();
00341 
00342       unsigned Opc = Alpha::WTF;
00343       bool rev = false;
00344       bool inv = false;
00345       switch(CC) {
00346       default: DEBUG(N->dump(CurDAG)); assert(0 && "Unknown FP comparison!");
00347       case ISD::SETEQ: case ISD::SETOEQ: case ISD::SETUEQ:
00348         Opc = Alpha::CMPTEQ; break;
00349       case ISD::SETLT: case ISD::SETOLT: case ISD::SETULT: 
00350         Opc = Alpha::CMPTLT; break;
00351       case ISD::SETLE: case ISD::SETOLE: case ISD::SETULE: 
00352         Opc = Alpha::CMPTLE; break;
00353       case ISD::SETGT: case ISD::SETOGT: case ISD::SETUGT: 
00354         Opc = Alpha::CMPTLT; rev = true; break;
00355       case ISD::SETGE: case ISD::SETOGE: case ISD::SETUGE: 
00356         Opc = Alpha::CMPTLE; rev = true; break;
00357       case ISD::SETNE: case ISD::SETONE: case ISD::SETUNE:
00358         Opc = Alpha::CMPTEQ; inv = true; break;
00359       case ISD::SETO:
00360         Opc = Alpha::CMPTUN; inv = true; break;
00361       case ISD::SETUO:
00362         Opc = Alpha::CMPTUN; break;
00363       };
00364       SDValue tmp1 = N->getOperand(rev?1:0);
00365       SDValue tmp2 = N->getOperand(rev?0:1);
00366       SDNode *cmp = CurDAG->getTargetNode(Opc, MVT::f64, tmp1, tmp2);
00367       if (inv) 
00368         cmp = CurDAG->getTargetNode(Alpha::CMPTEQ, MVT::f64, SDValue(cmp, 0), 
00369                                     CurDAG->getRegister(Alpha::F31, MVT::f64));
00370       switch(CC) {
00371       case ISD::SETUEQ: case ISD::SETULT: case ISD::SETULE:
00372       case ISD::SETUNE: case ISD::SETUGT: case ISD::SETUGE:
00373        {
00374          SDNode* cmp2 = CurDAG->getTargetNode(Alpha::CMPTUN, MVT::f64,
00375                                               tmp1, tmp2);
00376          cmp = CurDAG->getTargetNode(Alpha::ADDT, MVT::f64, 
00377                                      SDValue(cmp2, 0), SDValue(cmp, 0));
00378          break;
00379        }
00380       default: break;
00381       }
00382 
00383       SDNode* LD = CurDAG->getTargetNode(Alpha::FTOIT, MVT::i64, SDValue(cmp, 0));
00384       return CurDAG->getTargetNode(Alpha::CMPULT, MVT::i64, 
00385                                    CurDAG->getRegister(Alpha::R31, MVT::i64),
00386                                    SDValue(LD,0));
00387     }
00388     break;
00389 
00390   case ISD::SELECT:
00391     if (N->getValueType(0).isFloatingPoint() &&
00392         (N->getOperand(0).getOpcode() != ISD::SETCC ||
00393          !N->getOperand(0).getOperand(1).getValueType().isFloatingPoint())) {
00394       //This should be the condition not covered by the Patterns
00395       //FIXME: Don't have SelectCode die, but rather return something testable
00396       // so that things like this can be caught in fall though code
00397       //move int to fp
00398       bool isDouble = N->getValueType(0) == MVT::f64;
00399       SDValue cond = N->getOperand(0);
00400       SDValue TV = N->getOperand(1);
00401       SDValue FV = N->getOperand(2);
00402       
00403       SDNode* LD = CurDAG->getTargetNode(Alpha::ITOFT, MVT::f64, cond);
00404       return CurDAG->getTargetNode(isDouble?Alpha::FCMOVNET:Alpha::FCMOVNES,
00405                                    MVT::f64, FV, TV, SDValue(LD,0));
00406     }
00407     break;
00408 
00409   case ISD::AND: {
00410     ConstantSDNode* SC = NULL;
00411     ConstantSDNode* MC = NULL;
00412     if (N->getOperand(0).getOpcode() == ISD::SRL &&
00413         (MC = dyn_cast<ConstantSDNode>(N->getOperand(1))) &&
00414         (SC = dyn_cast<ConstantSDNode>(N->getOperand(0).getOperand(1)))) {
00415       uint64_t sval = SC->getZExtValue();
00416       uint64_t mval = MC->getZExtValue();
00417       // If the result is a zap, let the autogened stuff handle it.
00418       if (get_zapImm(N->getOperand(0), mval))
00419         break;
00420       // given mask X, and shift S, we want to see if there is any zap in the
00421       // mask if we play around with the botton S bits
00422       uint64_t dontcare = (~0ULL) >> (64 - sval);
00423       uint64_t mask = mval << sval;
00424       
00425       if (get_zapImm(mask | dontcare))
00426         mask = mask | dontcare;
00427       
00428       if (get_zapImm(mask)) {
00429         SDValue Z = 
00430           SDValue(CurDAG->getTargetNode(Alpha::ZAPNOTi, MVT::i64,
00431                                           N->getOperand(0).getOperand(0),
00432                                           getI64Imm(get_zapImm(mask))), 0);
00433         return CurDAG->getTargetNode(Alpha::SRLr, MVT::i64, Z, 
00434                                      getI64Imm(sval));
00435       }
00436     }
00437     break;
00438   }
00439 
00440   }
00441 
00442   return SelectCode(Op);
00443 }
00444 
00445 void AlphaDAGToDAGISel::SelectCALL(SDValue Op) {
00446   //TODO: add flag stuff to prevent nondeturministic breakage!
00447 
00448   SDNode *N = Op.getNode();
00449   SDValue Chain = N->getOperand(0);
00450   SDValue Addr = N->getOperand(1);
00451   SDValue InFlag(0,0);  // Null incoming flag value.
00452 
00453    std::vector<SDValue> CallOperands;
00454    std::vector<MVT> TypeOperands;
00455   
00456    //grab the arguments
00457    for(int i = 2, e = N->getNumOperands(); i < e; ++i) {
00458      TypeOperands.push_back(N->getOperand(i).getValueType());
00459      CallOperands.push_back(N->getOperand(i));
00460    }
00461    int count = N->getNumOperands() - 2;
00462 
00463    static const unsigned args_int[] = {Alpha::R16, Alpha::R17, Alpha::R18,
00464                                        Alpha::R19, Alpha::R20, Alpha::R21};
00465    static const unsigned args_float[] = {Alpha::F16, Alpha::F17, Alpha::F18,
00466                                          Alpha::F19, Alpha::F20, Alpha::F21};
00467    
00468    for (int i = 6; i < count; ++i) {
00469      unsigned Opc = Alpha::WTF;
00470      if (TypeOperands[i].isInteger()) {
00471        Opc = Alpha::STQ;
00472      } else if (TypeOperands[i] == MVT::f32) {
00473        Opc = Alpha::STS;
00474      } else if (TypeOperands[i] == MVT::f64) {
00475        Opc = Alpha::STT;
00476      } else
00477        assert(0 && "Unknown operand"); 
00478 
00479      SDValue Ops[] = { CallOperands[i],  getI64Imm((i - 6) * 8), 
00480                          CurDAG->getCopyFromReg(Chain, Alpha::R30, MVT::i64),
00481                          Chain };
00482      Chain = SDValue(CurDAG->getTargetNode(Opc, MVT::Other, Ops, 4), 0);
00483    }
00484    for (int i = 0; i < std::min(6, count); ++i) {
00485      if (TypeOperands[i].isInteger()) {
00486        Chain = CurDAG->getCopyToReg(Chain, args_int[i], CallOperands[i], InFlag);
00487        InFlag = Chain.getValue(1);
00488      } else if (TypeOperands[i] == MVT::f32 || TypeOperands[i] == MVT::f64) {
00489        Chain = CurDAG->getCopyToReg(Chain, args_float[i], CallOperands[i], InFlag);
00490        InFlag = Chain.getValue(1);
00491      } else
00492        assert(0 && "Unknown operand"); 
00493    }
00494 
00495    // Finally, once everything is in registers to pass to the call, emit the
00496    // call itself.
00497    if (Addr.getOpcode() == AlphaISD::GPRelLo) {
00498      SDValue GOT = getGlobalBaseReg();
00499      Chain = CurDAG->getCopyToReg(Chain, Alpha::R29, GOT, InFlag);
00500      InFlag = Chain.getValue(1);
00501      Chain = SDValue(CurDAG->getTargetNode(Alpha::BSR, MVT::Other, MVT::Flag, 
00502                                              Addr.getOperand(0), Chain, InFlag), 0);
00503    } else {
00504      Chain = CurDAG->getCopyToReg(Chain, Alpha::R27, Addr, InFlag);
00505      InFlag = Chain.getValue(1);
00506      Chain = SDValue(CurDAG->getTargetNode(Alpha::JSR, MVT::Other, MVT::Flag, 
00507                                              Chain, InFlag), 0);
00508    }
00509    InFlag = Chain.getValue(1);
00510 
00511    std::vector<SDValue> CallResults;
00512   
00513    switch (N->getValueType(0).getSimpleVT()) {
00514    default: assert(0 && "Unexpected ret value!");
00515      case MVT::Other: break;
00516    case MVT::i64:
00517      Chain = CurDAG->getCopyFromReg(Chain, Alpha::R0, MVT::i64, InFlag).getValue(1);
00518      CallResults.push_back(Chain.getValue(0));
00519      break;
00520    case MVT::f32:
00521      Chain = CurDAG->getCopyFromReg(Chain, Alpha::F0, MVT::f32, InFlag).getValue(1);
00522      CallResults.push_back(Chain.getValue(0));
00523      break;
00524    case MVT::f64:
00525      Chain = CurDAG->getCopyFromReg(Chain, Alpha::F0, MVT::f64, InFlag).getValue(1);
00526      CallResults.push_back(Chain.getValue(0));
00527      break;
00528    }
00529 
00530    CallResults.push_back(Chain);
00531    for (unsigned i = 0, e = CallResults.size(); i != e; ++i)
00532      ReplaceUses(Op.getValue(i), CallResults[i]);
00533 }
00534 
00535 
00536 /// createAlphaISelDag - This pass converts a legalized DAG into a 
00537 /// Alpha-specific DAG, ready for instruction scheduling.
00538 ///
00539 FunctionPass *llvm::createAlphaISelDag(AlphaTargetMachine &TM) {
00540   return new AlphaDAGToDAGISel(TM);
00541 }