LLVM API Documentation

SPUTargetMachine.cpp

Go to the documentation of this file.
00001 //===-- SPUTargetMachine.cpp - Define TargetMachine for Cell SPU ----------===//
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 // Top-level implementation for the Cell SPU target.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "SPU.h"
00015 #include "SPURegisterNames.h"
00016 #include "SPUTargetAsmInfo.h"
00017 #include "SPUTargetMachine.h"
00018 #include "llvm/PassManager.h"
00019 #include "llvm/CodeGen/RegAllocRegistry.h"
00020 #include "llvm/CodeGen/SchedulerRegistry.h"
00021 #include "llvm/Target/TargetRegistry.h"
00022 
00023 using namespace llvm;
00024 
00025 extern "C" void LLVMInitializeCellSPUTarget() { 
00026   // Register the target.
00027   RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
00028   RegisterAsmInfo<SPULinuxTargetAsmInfo> Y(TheCellSPUTarget);
00029 }
00030 
00031 const std::pair<unsigned, int> *
00032 SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
00033   NumEntries = 1;
00034   return &LR[0];
00035 }
00036 
00037 SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
00038                                    const std::string &FS)
00039   : LLVMTargetMachine(T, TT),
00040     Subtarget(TT, FS),
00041     DataLayout(Subtarget.getTargetDataString()),
00042     InstrInfo(*this),
00043     FrameInfo(*this),
00044     TLInfo(*this),
00045     InstrItins(Subtarget.getInstrItineraryData()) {
00046   // For the time being, use static relocations, since there's really no
00047   // support for PIC yet.
00048   setRelocationModel(Reloc::Static);
00049 }
00050 
00051 //===----------------------------------------------------------------------===//
00052 // Pass Pipeline Configuration
00053 //===----------------------------------------------------------------------===//
00054 
00055 bool SPUTargetMachine::addInstSelector(PassManagerBase &PM,
00056                                        CodeGenOpt::Level OptLevel) {
00057   // Install an instruction selector.
00058   PM.add(createSPUISelDag(*this));
00059   return false;
00060 }