blob: f24a32080b002d42029c9c35babcaebda9c9c649 [file] [log] [blame]
Misha Brukman116f9272004-08-17 04:55:41 +00001//===-- PPC32TargetMachine.h - Define TargetMachine for PowerPC -*- C++ -*-=//
Misha Brukmanb4402432005-04-21 23:30:14 +00002//
Misha Brukmand022a5a2004-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 Brukmanb4402432005-04-21 23:30:14 +00007//
Misha Brukmand022a5a2004-08-11 00:09:42 +00008//===----------------------------------------------------------------------===//
Misha Brukmanb4402432005-04-21 23:30:14 +00009//
Misha Brukman116f9272004-08-17 04:55:41 +000010// This file declares the PowerPC specific subclass of TargetMachine.
Misha Brukmand022a5a2004-08-11 00:09:42 +000011//
12//===----------------------------------------------------------------------===//
13
Misha Brukman116f9272004-08-17 04:55:41 +000014#ifndef POWERPC32_TARGETMACHINE_H
15#define POWERPC32_TARGETMACHINE_H
Misha Brukmand022a5a2004-08-11 00:09:42 +000016
Chris Lattnerbfca1ab2005-10-14 23:51:18 +000017#include "PPCFrameInfo.h"
18#include "PPCSubtarget.h"
Chris Lattner0aa794b2005-10-14 23:53:41 +000019#include "PPCJITInfo.h"
Chris Lattner6f3b9542005-10-14 23:59:06 +000020#include "PPCInstrInfo.h"
Chris Lattner2ed745a2005-10-14 23:44:05 +000021#include "llvm/Target/TargetMachine.h"
Misha Brukmand022a5a2004-08-11 00:09:42 +000022
23namespace llvm {
Chris Lattner03354282005-10-15 21:58:54 +000024class PassManager;
Misha Brukmand022a5a2004-08-11 00:09:42 +000025class IntrinsicLowering;
Chris Lattner2ed745a2005-10-14 23:44:05 +000026class GlobalValue;
27class IntrinsicLowering;
Misha Brukmand022a5a2004-08-11 00:09:42 +000028
Chris Lattner2ed745a2005-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 Brukmand022a5a2004-08-11 00:09:42 +000046class PPC32TargetMachine : public PowerPCTargetMachine {
Misha Brukman116f9272004-08-17 04:55:41 +000047 PPC32InstrInfo InstrInfo;
Chris Lattnerf5363dc2004-11-23 05:56:40 +000048 PPC32JITInfo JITInfo;
Misha Brukman116f9272004-08-17 04:55:41 +000049
Misha Brukmand022a5a2004-08-11 00:09:42 +000050public:
Jim Laskey19058c32005-09-01 21:38:21 +000051 PPC32TargetMachine(const Module &M, IntrinsicLowering *IL,
52 const std::string &FS);
Misha Brukman116f9272004-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 Brukmand022a5a2004-08-11 00:09:42 +000057
Chris Lattnerf5363dc2004-11-23 05:56:40 +000058 virtual TargetJITInfo *getJITInfo() {
59 return &JITInfo;
60 }
61
62 static unsigned getJITMatchQuality();
63
Misha Brukmand022a5a2004-08-11 00:09:42 +000064 static unsigned getModuleMatchQuality(const Module &M);
Misha Brukman116f9272004-08-17 04:55:41 +000065
66 bool addPassesToEmitMachineCode(FunctionPassManager &PM,
67 MachineCodeEmitter &MCE);
Misha Brukmand022a5a2004-08-11 00:09:42 +000068};
69
70} // end namespace llvm
71
72#endif