Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- PPCTargetMachine.h - Define TargetMachine for PowerPC ---*- C++ -*-===// |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 2 | // |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 7 | // |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 9 | // |
Misha Brukman | f2ccb77 | 2004-08-17 04:55:41 +0000 | [diff] [blame] | 10 | // This file declares the PowerPC specific subclass of TargetMachine. |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 14 | #ifndef PPC_TARGETMACHINE_H |
| 15 | #define PPC_TARGETMACHINE_H |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 16 | |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 17 | #include "PPCFrameLowering.h" |
Chris Lattner | 2668959 | 2005-10-14 23:51:18 +0000 | [diff] [blame] | 18 | #include "PPCSubtarget.h" |
Chris Lattner | b9459b7 | 2005-10-14 23:53:41 +0000 | [diff] [blame] | 19 | #include "PPCJITInfo.h" |
Chris Lattner | 16e71f2 | 2005-10-14 23:59:06 +0000 | [diff] [blame] | 20 | #include "PPCInstrInfo.h" |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 21 | #include "PPCISelLowering.h" |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 22 | #include "PPCSelectionDAGInfo.h" |
Chris Lattner | ec4b73c | 2005-10-14 23:44:05 +0000 | [diff] [blame] | 23 | #include "llvm/Target/TargetMachine.h" |
Micah Villmow | 3574eca | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 24 | #include "llvm/DataLayout.h" |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 25 | |
| 26 | namespace llvm { |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 27 | |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 28 | /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets. |
| 29 | /// |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 30 | class PPCTargetMachine : public LLVMTargetMachine { |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 31 | PPCSubtarget Subtarget; |
Micah Villmow | 3574eca | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 32 | const DataLayout DL; // Calculates type size & alignment |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 33 | PPCInstrInfo InstrInfo; |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 34 | PPCFrameLowering FrameLowering; |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 35 | PPCJITInfo JITInfo; |
| 36 | PPCTargetLowering TLInfo; |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 37 | PPCSelectionDAGInfo TSInfo; |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 38 | InstrItineraryData InstrItins; |
Bill Wendling | 0ea18ff | 2007-01-24 03:41:36 +0000 | [diff] [blame] | 39 | |
Chris Lattner | ec4b73c | 2005-10-14 23:44:05 +0000 | [diff] [blame] | 40 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 41 | PPCTargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 42 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 43 | Reloc::Model RM, CodeModel::Model CM, |
| 44 | CodeGenOpt::Level OL, bool is64Bit); |
Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 45 | |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 46 | virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; } |
| 47 | virtual const PPCFrameLowering *getFrameLowering() const { |
| 48 | return &FrameLowering; |
| 49 | } |
| 50 | virtual PPCJITInfo *getJITInfo() { return &JITInfo; } |
Andrew Trick | 8247e0d | 2012-02-03 05:12:30 +0000 | [diff] [blame] | 51 | virtual const PPCTargetLowering *getTargetLowering() const { |
Dan Gohman | d858e90 | 2010-04-17 15:26:15 +0000 | [diff] [blame] | 52 | return &TLInfo; |
Chris Lattner | b65e725 | 2006-05-12 21:09:57 +0000 | [diff] [blame] | 53 | } |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 54 | virtual const PPCSelectionDAGInfo* getSelectionDAGInfo() const { |
| 55 | return &TSInfo; |
| 56 | } |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 57 | virtual const PPCRegisterInfo *getRegisterInfo() const { |
Misha Brukman | f2ccb77 | 2004-08-17 04:55:41 +0000 | [diff] [blame] | 58 | return &InstrInfo.getRegisterInfo(); |
| 59 | } |
Andrew Trick | 8247e0d | 2012-02-03 05:12:30 +0000 | [diff] [blame] | 60 | |
Micah Villmow | 3574eca | 2012-10-08 16:38:25 +0000 | [diff] [blame] | 61 | virtual const DataLayout *getDataLayout() const { return &DL; } |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 62 | virtual const PPCSubtarget *getSubtargetImpl() const { return &Subtarget; } |
Andrew Trick | 8247e0d | 2012-02-03 05:12:30 +0000 | [diff] [blame] | 63 | virtual const InstrItineraryData *getInstrItineraryData() const { |
Evan Cheng | 3ef1c87 | 2010-09-10 01:29:16 +0000 | [diff] [blame] | 64 | return &InstrItins; |
Jim Laskey | 6cee630 | 2005-11-01 20:06:59 +0000 | [diff] [blame] | 65 | } |
Anton Korobeynikov | 06be997 | 2008-08-17 13:54:28 +0000 | [diff] [blame] | 66 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 67 | // Pass Pipeline Configuration |
Andrew Trick | 061efcf | 2012-02-04 02:56:59 +0000 | [diff] [blame] | 68 | virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 69 | virtual bool addCodeEmitter(PassManagerBase &PM, |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 70 | JITCodeEmitter &JCE); |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 71 | }; |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 72 | |
| 73 | /// PPC32TargetMachine - PowerPC 32-bit target machine. |
| 74 | /// |
| 75 | class PPC32TargetMachine : public PPCTargetMachine { |
David Blaikie | 2d24e2a | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 76 | virtual void anchor(); |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 77 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 78 | PPC32TargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 79 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 80 | Reloc::Model RM, CodeModel::Model CM, |
| 81 | CodeGenOpt::Level OL); |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | /// PPC64TargetMachine - PowerPC 64-bit target machine. |
| 85 | /// |
| 86 | class PPC64TargetMachine : public PPCTargetMachine { |
David Blaikie | 2d24e2a | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 87 | virtual void anchor(); |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 88 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 89 | PPC64TargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame] | 90 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 91 | Reloc::Model RM, CodeModel::Model CM, |
| 92 | CodeGenOpt::Level OL); |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 93 | }; |
| 94 | |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 95 | } // end namespace llvm |
| 96 | |
| 97 | #endif |