blob: f24a32080b002d42029c9c35babcaebda9c9c649 [file] [log] [blame]
Misha Brukmanf2ccb772004-08-17 04:55:41 +00001//===-- PPC32TargetMachine.h - Define TargetMachine for PowerPC -*- C++ -*-=//
Misha Brukmanb5f662f2005-04-21 23:30:14 +00002//
Misha Brukman3d9a6c22004-08-11 00:09:42 +00003// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
Misha Brukmanb5f662f2005-04-21 23:30:14 +00007//
Misha Brukman3d9a6c22004-08-11 00:09:42 +00008//===----------------------------------------------------------------------===//
Misha Brukmanb5f662f2005-04-21 23:30:14 +00009//
Misha Brukmanf2ccb772004-08-17 04:55:41 +000010// This file declares the PowerPC specific subclass of TargetMachine.
Misha Brukman3d9a6c22004-08-11 00:09:42 +000011//
12//===----------------------------------------------------------------------===//
13
Misha Brukmanf2ccb772004-08-17 04:55:41 +000014#ifndef POWERPC32_TARGETMACHINE_H
15#define POWERPC32_TARGETMACHINE_H
Misha Brukman3d9a6c22004-08-11 00:09:42 +000016
Chris Lattner26689592005-10-14 23:51:18 +000017#include "PPCFrameInfo.h"
18#include "PPCSubtarget.h"
Chris Lattnerb9459b72005-10-14 23:53:41 +000019#include "PPCJITInfo.h"
Chris Lattner16e71f22005-10-14 23:59:06 +000020#include "PPCInstrInfo.h"
Chris Lattnerec4b73c2005-10-14 23:44:05 +000021#include "llvm/Target/TargetMachine.h"
Misha Brukman3d9a6c22004-08-11 00:09:42 +000022
23namespace llvm {
Chris Lattnerde123822005-10-15 21:58:54 +000024class PassManager;
Misha Brukman3d9a6c22004-08-11 00:09:42 +000025class IntrinsicLowering;
Chris Lattnerec4b73c2005-10-14 23:44:05 +000026class GlobalValue;
27class IntrinsicLowering;
Misha Brukman3d9a6c22004-08-11 00:09:42 +000028
Chris Lattnerec4b73c2005-10-14 23:44:05 +000029// FIXME: Merge into only subclass.
30class PowerPCTargetMachine : public TargetMachine {
31 PowerPCFrameInfo FrameInfo;
32 PPCSubtarget Subtarget;
33protected:
34 PowerPCTargetMachine(const std::string &name, IntrinsicLowering *IL,
35 const Module &M, const std::string &FS,
36 const TargetData &TD,
37 const PowerPCFrameInfo &TFI);
38public:
39 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
40 virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; }
41
42 virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
43 CodeGenFileType FileType);
44};
45
Misha Brukman3d9a6c22004-08-11 00:09:42 +000046class PPC32TargetMachine : public PowerPCTargetMachine {
Misha Brukmanf2ccb772004-08-17 04:55:41 +000047 PPC32InstrInfo InstrInfo;
Chris Lattnere4fce6f2004-11-23 05:56:40 +000048 PPC32JITInfo JITInfo;
Misha Brukmanf2ccb772004-08-17 04:55:41 +000049
Misha Brukman3d9a6c22004-08-11 00:09:42 +000050public:
Jim Laskeyb1e11802005-09-01 21:38:21 +000051 PPC32TargetMachine(const Module &M, IntrinsicLowering *IL,
52 const std::string &FS);
Misha Brukmanf2ccb772004-08-17 04:55:41 +000053 virtual const PPC32InstrInfo *getInstrInfo() const { return &InstrInfo; }
54 virtual const MRegisterInfo *getRegisterInfo() const {
55 return &InstrInfo.getRegisterInfo();
56 }
Misha Brukman3d9a6c22004-08-11 00:09:42 +000057
Chris Lattnere4fce6f2004-11-23 05:56:40 +000058 virtual TargetJITInfo *getJITInfo() {
59 return &JITInfo;
60 }
61
62 static unsigned getJITMatchQuality();
63
Misha Brukman3d9a6c22004-08-11 00:09:42 +000064 static unsigned getModuleMatchQuality(const Module &M);
Misha Brukmanf2ccb772004-08-17 04:55:41 +000065
66 bool addPassesToEmitMachineCode(FunctionPassManager &PM,
67 MachineCodeEmitter &MCE);
Misha Brukman3d9a6c22004-08-11 00:09:42 +000068};
69
70} // end namespace llvm
71
72#endif