Home | History | Annotate | Download | only in CellSPU
      1 //===-- SPUTargetMachine.cpp - Define TargetMachine for Cell SPU ----------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // Top-level implementation for the Cell SPU target.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #include "SPU.h"
     15 #include "SPUTargetMachine.h"
     16 #include "llvm/PassManager.h"
     17 #include "llvm/CodeGen/RegAllocRegistry.h"
     18 #include "llvm/CodeGen/SchedulerRegistry.h"
     19 #include "llvm/Target/TargetRegistry.h"
     20 
     21 using namespace llvm;
     22 
     23 extern "C" void LLVMInitializeCellSPUTarget() {
     24   // Register the target.
     25   RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
     26 }
     27 
     28 const std::pair<unsigned, int> *
     29 SPUFrameLowering::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
     30   NumEntries = 1;
     31   return &LR[0];
     32 }
     33 
     34 SPUTargetMachine::SPUTargetMachine(const Target &T, StringRef TT,
     35                                    StringRef CPU,StringRef FS, Reloc::Model RM)
     36   : LLVMTargetMachine(T, TT, CPU, FS, RM),
     37     Subtarget(TT, CPU, FS),
     38     DataLayout(Subtarget.getTargetDataString()),
     39     InstrInfo(*this),
     40     FrameLowering(Subtarget),
     41     TLInfo(*this),
     42     TSInfo(*this),
     43     InstrItins(Subtarget.getInstrItineraryData()) {
     44 }
     45 
     46 //===----------------------------------------------------------------------===//
     47 // Pass Pipeline Configuration
     48 //===----------------------------------------------------------------------===//
     49 
     50 bool SPUTargetMachine::addInstSelector(PassManagerBase &PM,
     51                                        CodeGenOpt::Level OptLevel) {
     52   // Install an instruction selector.
     53   PM.add(createSPUISelDag(*this));
     54   return false;
     55 }
     56 
     57 // passes to run just before printing the assembly
     58 bool SPUTargetMachine::
     59 addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
     60 {
     61   //align instructions with nops/lnops for dual issue
     62   PM.add(createSPUNopFillerPass(*this));
     63   return true;
     64 }
     65