blob: fab576d7dad5f8b521d8197f2af01ba49ea33b9d [file] [log] [blame]
Akira Hatanaka4552c9a2011-04-15 21:51:11 +00001//===-- MipsTargetMachine.h - Define TargetMachine for Mips -00--*- C++ -*-===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00002//
3// 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.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00007//
Akira Hatanaka4552c9a2011-04-15 21:51:11 +00008//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00009//
10// This file declares the Mips specific subclass of TargetMachine.
11//
Akira Hatanaka4552c9a2011-04-15 21:51:11 +000012//===----------------------------------------------------------------------===//
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000013
14#ifndef MIPSTARGETMACHINE_H
15#define MIPSTARGETMACHINE_H
16
17#include "MipsSubtarget.h"
18#include "MipsInstrInfo.h"
19#include "MipsISelLowering.h"
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000020#include "MipsFrameLowering.h"
Dan Gohmanff7a5622010-05-11 17:31:57 +000021#include "MipsSelectionDAGInfo.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000022#include "llvm/Target/TargetMachine.h"
23#include "llvm/Target/TargetData.h"
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000024#include "llvm/Target/TargetFrameLowering.h"
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000025#include "MipsJITInfo.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000026
27namespace llvm {
David Greene71847812009-07-14 20:18:05 +000028 class formatted_raw_ostream;
Anton Korobeynikov33464912010-11-15 00:06:54 +000029
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000030 class MipsTargetMachine : public LLVMTargetMachine {
31 MipsSubtarget Subtarget;
32 const TargetData DataLayout; // Calculates type size & alignment
33 MipsInstrInfo InstrInfo;
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000034 MipsFrameLowering FrameLowering;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000035 MipsTargetLowering TLInfo;
Dan Gohmanff7a5622010-05-11 17:31:57 +000036 MipsSelectionDAGInfo TSInfo;
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000037 MipsJITInfo JITInfo;
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000038
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000039 public:
Evan Cheng43966132011-07-19 06:37:02 +000040 MipsTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000041 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Cheng34ad6db2011-07-20 07:51:56 +000042 Reloc::Model RM, CodeModel::Model CM,
Evan Chengb95fc312011-11-16 08:38:26 +000043 CodeGenOpt::Level OL,
Evan Cheng34ad6db2011-07-20 07:51:56 +000044 bool isLittle);
Anton Korobeynikov33464912010-11-15 00:06:54 +000045
46 virtual const MipsInstrInfo *getInstrInfo() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000047 { return &InstrInfo; }
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000048 virtual const TargetFrameLowering *getFrameLowering() const
49 { return &FrameLowering; }
Anton Korobeynikov33464912010-11-15 00:06:54 +000050 virtual const MipsSubtarget *getSubtargetImpl() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000051 { return &Subtarget; }
Anton Korobeynikov33464912010-11-15 00:06:54 +000052 virtual const TargetData *getTargetData() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000053 { return &DataLayout;}
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000054 virtual MipsJITInfo *getJITInfo()
55 { return &JITInfo; }
56
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000057
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000058 virtual const MipsRegisterInfo *getRegisterInfo() const {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000059 return &InstrInfo.getRegisterInfo();
60 }
61
Anton Korobeynikov33464912010-11-15 00:06:54 +000062 virtual const MipsTargetLowering *getTargetLowering() const {
Dan Gohmand858e902010-04-17 15:26:15 +000063 return &TLInfo;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000064 }
65
Dan Gohmanff7a5622010-05-11 17:31:57 +000066 virtual const MipsSelectionDAGInfo* getSelectionDAGInfo() const {
67 return &TSInfo;
68 }
69
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000070 // Pass Pipeline Configuration
Andrew Trick061efcf2012-02-04 02:56:59 +000071 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000072 virtual bool addCodeEmitter(PassManagerBase &PM,
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000073 JITCodeEmitter &JCE);
74
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000075 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000076
Akira Hatanaka24648102011-09-21 03:00:58 +000077/// MipsebTargetMachine - Mips32 big endian target machine.
78///
79class MipsebTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000080 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +000081public:
82 MipsebTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000083 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000084 Reloc::Model RM, CodeModel::Model CM,
85 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +000086};
87
88/// MipselTargetMachine - Mips32 little endian target machine.
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000089///
90class MipselTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000091 virtual void anchor();
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000092public:
Evan Cheng43966132011-07-19 06:37:02 +000093 MipselTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000094 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000095 Reloc::Model RM, CodeModel::Model CM,
96 CodeGenOpt::Level OL);
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000097};
98
Akira Hatanaka4e414162011-09-22 17:26:58 +000099/// Mips64ebTargetMachine - Mips64 big endian target machine.
Akira Hatanaka24648102011-09-21 03:00:58 +0000100///
101class Mips64ebTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +0000102 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +0000103public:
104 Mips64ebTargetMachine(const Target &T, StringRef TT,
105 StringRef CPU, StringRef FS,
Nick Lewycky8a8d4792011-12-02 22:16:29 +0000106 const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +0000107 Reloc::Model RM, CodeModel::Model CM,
108 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000109};
110
Akira Hatanaka4e414162011-09-22 17:26:58 +0000111/// Mips64elTargetMachine - Mips64 little endian target machine.
Akira Hatanaka24648102011-09-21 03:00:58 +0000112///
113class Mips64elTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +0000114 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +0000115public:
116 Mips64elTargetMachine(const Target &T, StringRef TT,
117 StringRef CPU, StringRef FS,
Nick Lewycky8a8d4792011-12-02 22:16:29 +0000118 const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +0000119 Reloc::Model RM, CodeModel::Model CM,
120 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000121};
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000122} // End llvm namespace
123
124#endif