2004-01-22 05:13:19 +08:00
|
|
|
//===-- PowerPCTargetMachine.cpp - Define TargetMachine for PowerPC -------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "PowerPCTargetMachine.h"
|
2004-02-03 03:06:36 +08:00
|
|
|
#include "PowerPC.h"
|
2004-01-22 05:13:19 +08:00
|
|
|
#include "llvm/Module.h"
|
|
|
|
#include "llvm/PassManager.h"
|
2004-07-11 12:17:10 +08:00
|
|
|
#include "llvm/Target/TargetOptions.h"
|
2004-07-11 10:48:49 +08:00
|
|
|
#include "llvm/Target/TargetMachineRegistry.h"
|
2004-01-22 05:13:19 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2004-02-29 03:53:18 +08:00
|
|
|
using namespace llvm;
|
2004-01-22 05:13:19 +08:00
|
|
|
|
2004-07-11 10:48:49 +08:00
|
|
|
namespace {
|
|
|
|
// Register the target.
|
2004-07-11 11:27:42 +08:00
|
|
|
RegisterTarget<PowerPCTargetMachine> X("powerpc", " PowerPC (experimental)");
|
2004-07-11 10:48:49 +08:00
|
|
|
}
|
|
|
|
|
2004-01-22 05:13:19 +08:00
|
|
|
/// PowerPCTargetMachine ctor - Create an ILP32 architecture model
|
|
|
|
///
|
|
|
|
PowerPCTargetMachine::PowerPCTargetMachine(const Module &M,
|
|
|
|
IntrinsicLowering *IL)
|
|
|
|
: TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4),
|
2004-06-10 14:19:25 +08:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4), JITInfo(*this) {
|
2004-01-22 05:13:19 +08:00
|
|
|
}
|
|
|
|
|
2004-02-03 03:06:36 +08:00
|
|
|
/// addPassesToEmitAssembly - Add passes to the specified pass manager
|
|
|
|
/// to implement a static compiler for this target.
|
|
|
|
///
|
2004-01-22 05:13:19 +08:00
|
|
|
bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM,
|
|
|
|
std::ostream &Out) {
|
2004-02-03 03:06:36 +08:00
|
|
|
// <insert instruction selector passes here>
|
|
|
|
PM.add(createRegisterAllocator());
|
|
|
|
PM.add(createPrologEpilogCodeInserter());
|
|
|
|
// <insert assembly code output passes here>
|
2004-02-15 08:03:15 +08:00
|
|
|
PM.add(createMachineCodeDeleter());
|
2004-02-03 03:06:36 +08:00
|
|
|
return true; // change to `return false' when this actually works.
|
2004-01-22 05:13:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// addPassesToJITCompile - Add passes to the specified pass manager to
|
2004-01-23 14:35:43 +08:00
|
|
|
/// implement a fast dynamic compiler for this target.
|
2004-01-22 05:13:19 +08:00
|
|
|
///
|
2004-01-23 14:35:43 +08:00
|
|
|
void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
|
2004-02-03 03:06:36 +08:00
|
|
|
// <insert instruction selector passes here>
|
|
|
|
PM.add(createRegisterAllocator());
|
|
|
|
PM.add(createPrologEpilogCodeInserter());
|
2004-01-22 05:13:19 +08:00
|
|
|
}
|
|
|
|
|