blob: 02d69fd15d1c3ce6db69f3cd264ed1d79127548f [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- PPCTargetMachine.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//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// 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
Nate Begeman21e463b2005-10-16 05:39:50 +000014#ifndef PPC_TARGETMACHINE_H
15#define PPC_TARGETMACHINE_H
Misha Brukman3d9a6c22004-08-11 00:09:42 +000016
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000017#include "PPCFrameLowering.h"
Chris Lattner26689592005-10-14 23:51:18 +000018#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"
Evan Chengc4c62572006-03-13 23:20:37 +000021#include "PPCISelLowering.h"
Dan Gohmanff7a5622010-05-11 17:31:57 +000022#include "PPCSelectionDAGInfo.h"
Chris Lattnerec4b73c2005-10-14 23:44:05 +000023#include "llvm/Target/TargetMachine.h"
Micah Villmow3574eca2012-10-08 16:38:25 +000024#include "llvm/DataLayout.h"
Misha Brukman3d9a6c22004-08-11 00:09:42 +000025
26namespace llvm {
Misha Brukman3d9a6c22004-08-11 00:09:42 +000027
Chris Lattner94de9a82006-06-16 01:37:27 +000028/// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
29///
Chris Lattner1911fd42006-09-04 04:14:57 +000030class PPCTargetMachine : public LLVMTargetMachine {
Chris Lattner94de9a82006-06-16 01:37:27 +000031 PPCSubtarget Subtarget;
Micah Villmow3574eca2012-10-08 16:38:25 +000032 const DataLayout DL; // Calculates type size & alignment
Chris Lattner94de9a82006-06-16 01:37:27 +000033 PPCInstrInfo InstrInfo;
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000034 PPCFrameLowering FrameLowering;
Chris Lattner94de9a82006-06-16 01:37:27 +000035 PPCJITInfo JITInfo;
36 PPCTargetLowering TLInfo;
Dan Gohmanff7a5622010-05-11 17:31:57 +000037 PPCSelectionDAGInfo TSInfo;
Chris Lattner94de9a82006-06-16 01:37:27 +000038 InstrItineraryData InstrItins;
Bill Wendling0ea18ff2007-01-24 03:41:36 +000039
Chris Lattnerec4b73c2005-10-14 23:44:05 +000040public:
Evan Cheng43966132011-07-19 06:37:02 +000041 PPCTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000042 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000043 Reloc::Model RM, CodeModel::Model CM,
44 CodeGenOpt::Level OL, bool is64Bit);
Nate Begeman21e463b2005-10-16 05:39:50 +000045
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000046 virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
47 virtual const PPCFrameLowering *getFrameLowering() const {
48 return &FrameLowering;
49 }
50 virtual PPCJITInfo *getJITInfo() { return &JITInfo; }
Andrew Trick8247e0d2012-02-03 05:12:30 +000051 virtual const PPCTargetLowering *getTargetLowering() const {
Dan Gohmand858e902010-04-17 15:26:15 +000052 return &TLInfo;
Chris Lattnerb65e7252006-05-12 21:09:57 +000053 }
Dan Gohmanff7a5622010-05-11 17:31:57 +000054 virtual const PPCSelectionDAGInfo* getSelectionDAGInfo() const {
55 return &TSInfo;
56 }
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000057 virtual const PPCRegisterInfo *getRegisterInfo() const {
Misha Brukmanf2ccb772004-08-17 04:55:41 +000058 return &InstrInfo.getRegisterInfo();
59 }
Andrew Trick8247e0d2012-02-03 05:12:30 +000060
Micah Villmow3574eca2012-10-08 16:38:25 +000061 virtual const DataLayout *getDataLayout() const { return &DL; }
Chris Lattner94de9a82006-06-16 01:37:27 +000062 virtual const PPCSubtarget *getSubtargetImpl() const { return &Subtarget; }
Andrew Trick8247e0d2012-02-03 05:12:30 +000063 virtual const InstrItineraryData *getInstrItineraryData() const {
Evan Cheng3ef1c872010-09-10 01:29:16 +000064 return &InstrItins;
Jim Laskey6cee6302005-11-01 20:06:59 +000065 }
Anton Korobeynikov06be9972008-08-17 13:54:28 +000066
Chris Lattner1911fd42006-09-04 04:14:57 +000067 // Pass Pipeline Configuration
Andrew Trick061efcf2012-02-04 02:56:59 +000068 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
Evan Chengb95fc312011-11-16 08:38:26 +000069 virtual bool addCodeEmitter(PassManagerBase &PM,
Daniel Dunbarcfe9a602009-07-15 22:33:19 +000070 JITCodeEmitter &JCE);
Misha Brukman3d9a6c22004-08-11 00:09:42 +000071};
Chris Lattner94de9a82006-06-16 01:37:27 +000072
73/// PPC32TargetMachine - PowerPC 32-bit target machine.
74///
75class PPC32TargetMachine : public PPCTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000076 virtual void anchor();
Chris Lattner94de9a82006-06-16 01:37:27 +000077public:
Evan Cheng43966132011-07-19 06:37:02 +000078 PPC32TargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000079 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000080 Reloc::Model RM, CodeModel::Model CM,
81 CodeGenOpt::Level OL);
Chris Lattner94de9a82006-06-16 01:37:27 +000082};
83
84/// PPC64TargetMachine - PowerPC 64-bit target machine.
85///
86class PPC64TargetMachine : public PPCTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000087 virtual void anchor();
Chris Lattner94de9a82006-06-16 01:37:27 +000088public:
Evan Cheng43966132011-07-19 06:37:02 +000089 PPC64TargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000090 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000091 Reloc::Model RM, CodeModel::Model CM,
92 CodeGenOpt::Level OL);
Chris Lattner94de9a82006-06-16 01:37:27 +000093};
94
Misha Brukman3d9a6c22004-08-11 00:09:42 +000095} // end namespace llvm
96
97#endif