blob: b2a609c5c5246127264a67c785f14c62e2f4a222 [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 Trick843ee2e2012-02-03 05:12:41 +000071 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM,
72 bool DisableVerify);
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000073 virtual bool addCodeEmitter(PassManagerBase &PM,
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000074 JITCodeEmitter &JCE);
75
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000076 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000077
Akira Hatanaka24648102011-09-21 03:00:58 +000078/// MipsebTargetMachine - Mips32 big endian target machine.
79///
80class MipsebTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000081 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +000082public:
83 MipsebTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000084 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000085 Reloc::Model RM, CodeModel::Model CM,
86 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +000087};
88
89/// MipselTargetMachine - Mips32 little endian target machine.
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000090///
91class MipselTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000092 virtual void anchor();
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000093public:
Evan Cheng43966132011-07-19 06:37:02 +000094 MipselTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000095 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000096 Reloc::Model RM, CodeModel::Model CM,
97 CodeGenOpt::Level OL);
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000098};
99
Akira Hatanaka4e414162011-09-22 17:26:58 +0000100/// Mips64ebTargetMachine - Mips64 big endian target machine.
Akira Hatanaka24648102011-09-21 03:00:58 +0000101///
102class Mips64ebTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +0000103 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +0000104public:
105 Mips64ebTargetMachine(const Target &T, StringRef TT,
106 StringRef CPU, StringRef FS,
Nick Lewycky8a8d4792011-12-02 22:16:29 +0000107 const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +0000108 Reloc::Model RM, CodeModel::Model CM,
109 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000110};
111
Akira Hatanaka4e414162011-09-22 17:26:58 +0000112/// Mips64elTargetMachine - Mips64 little endian target machine.
Akira Hatanaka24648102011-09-21 03:00:58 +0000113///
114class Mips64elTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +0000115 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +0000116public:
117 Mips64elTargetMachine(const Target &T, StringRef TT,
118 StringRef CPU, StringRef FS,
Nick Lewycky8a8d4792011-12-02 22:16:29 +0000119 const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +0000120 Reloc::Model RM, CodeModel::Model CM,
121 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000122};
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000123} // End llvm namespace
124
125#endif