blob: 33180cdecf90695343e3efedb46fe3633b49c3e4 [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"
22#include "llvm/Target/TargetFrameInfo.h"
Misha Brukmanf2ccb772004-08-17 04:55:41 +000023#include "llvm/PassManager.h"
Misha Brukman3d9a6c22004-08-11 00:09:42 +000024
25namespace llvm {
26
Misha Brukman3d9a6c22004-08-11 00:09:42 +000027class IntrinsicLowering;
Chris Lattnerec4b73c2005-10-14 23:44:05 +000028class GlobalValue;
29class IntrinsicLowering;
Misha Brukman3d9a6c22004-08-11 00:09:42 +000030
Chris Lattnerec4b73c2005-10-14 23:44:05 +000031// FIXME: Merge into only subclass.
32class PowerPCTargetMachine : public TargetMachine {
33 PowerPCFrameInfo FrameInfo;
34 PPCSubtarget Subtarget;
35protected:
36 PowerPCTargetMachine(const std::string &name, IntrinsicLowering *IL,
37 const Module &M, const std::string &FS,
38 const TargetData &TD,
39 const PowerPCFrameInfo &TFI);
40public:
41 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
42 virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; }
43
44 virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
45 CodeGenFileType FileType);
46};
47
Misha Brukman3d9a6c22004-08-11 00:09:42 +000048class PPC32TargetMachine : public PowerPCTargetMachine {
Misha Brukmanf2ccb772004-08-17 04:55:41 +000049 PPC32InstrInfo InstrInfo;
Chris Lattnere4fce6f2004-11-23 05:56:40 +000050 PPC32JITInfo JITInfo;
Misha Brukmanf2ccb772004-08-17 04:55:41 +000051
Misha Brukman3d9a6c22004-08-11 00:09:42 +000052public:
Jim Laskeyb1e11802005-09-01 21:38:21 +000053 PPC32TargetMachine(const Module &M, IntrinsicLowering *IL,
54 const std::string &FS);
Misha Brukmanf2ccb772004-08-17 04:55:41 +000055 virtual const PPC32InstrInfo *getInstrInfo() const { return &InstrInfo; }
56 virtual const MRegisterInfo *getRegisterInfo() const {
57 return &InstrInfo.getRegisterInfo();
58 }
Misha Brukman3d9a6c22004-08-11 00:09:42 +000059
Chris Lattnere4fce6f2004-11-23 05:56:40 +000060 virtual TargetJITInfo *getJITInfo() {
61 return &JITInfo;
62 }
63
64 static unsigned getJITMatchQuality();
65
Misha Brukman3d9a6c22004-08-11 00:09:42 +000066 static unsigned getModuleMatchQuality(const Module &M);
Misha Brukmanf2ccb772004-08-17 04:55:41 +000067
68 bool addPassesToEmitMachineCode(FunctionPassManager &PM,
69 MachineCodeEmitter &MCE);
Misha Brukman3d9a6c22004-08-11 00:09:42 +000070};
71
72} // end namespace llvm
73
74#endif