opnsense-src/contrib/llvm/lib/Target/CellSPU/SPUTargetMachine.cpp

71 lines
2.2 KiB
C++
Raw Normal View History

2009-06-02 13:52:33 -04:00
//===-- SPUTargetMachine.cpp - Define TargetMachine for Cell SPU ----------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Top-level implementation for the Cell SPU target.
//
//===----------------------------------------------------------------------===//
#include "SPU.h"
#include "SPURegisterNames.h"
2009-10-14 13:57:32 -04:00
#include "SPUMCAsmInfo.h"
2009-06-02 13:52:33 -04:00
#include "SPUTargetMachine.h"
#include "llvm/PassManager.h"
#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/CodeGen/SchedulerRegistry.h"
2009-10-14 13:57:32 -04:00
#include "llvm/Target/TargetRegistry.h"
2009-06-02 13:52:33 -04:00
using namespace llvm;
2009-10-14 13:57:32 -04:00
extern "C" void LLVMInitializeCellSPUTarget() {
// Register the target.
RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
RegisterAsmInfo<SPULinuxMCAsmInfo> Y(TheCellSPUTarget);
2009-06-02 13:52:33 -04:00
}
const std::pair<unsigned, int> *
SPUFrameLowering::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
2009-06-02 13:52:33 -04:00
NumEntries = 1;
return &LR[0];
}
2009-10-14 13:57:32 -04:00
SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
const std::string &FS)
: LLVMTargetMachine(T, TT),
Subtarget(TT, FS),
2009-06-02 13:52:33 -04:00
DataLayout(Subtarget.getTargetDataString()),
InstrInfo(*this),
FrameLowering(Subtarget),
2009-06-02 13:52:33 -04:00
TLInfo(*this),
2010-05-27 11:15:58 -04:00
TSInfo(*this),
2009-10-14 13:57:32 -04:00
InstrItins(Subtarget.getInstrItineraryData()) {
2009-06-02 13:52:33 -04:00
// For the time being, use static relocations, since there's really no
// support for PIC yet.
setRelocationModel(Reloc::Static);
}
//===----------------------------------------------------------------------===//
// Pass Pipeline Configuration
//===----------------------------------------------------------------------===//
2009-10-14 13:57:32 -04:00
bool SPUTargetMachine::addInstSelector(PassManagerBase &PM,
CodeGenOpt::Level OptLevel) {
2009-06-02 13:52:33 -04:00
// Install an instruction selector.
PM.add(createSPUISelDag(*this));
return false;
}
// passes to run just before printing the assembly
bool SPUTargetMachine::
addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
{
//align instructions with nops/lnops for dual issue
PM.add(createSPUNopFillerPass(*this));
return true;
}