blob: 5cbf057416cc86d947b150493d0692be19210269 [file] [log] [blame]
Jia Liu8f5e8c12012-02-17 01:23:50 +00001//===-- MipsTargetMachine.h - Define TargetMachine for Mips -----*- 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
Craig Topper79aa3412012-03-17 18:46:09 +000017#include "MipsFrameLowering.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000018#include "MipsInstrInfo.h"
19#include "MipsISelLowering.h"
Craig Topper79aa3412012-03-17 18:46:09 +000020#include "MipsJITInfo.h"
Dan Gohmanff7a5622010-05-11 17:31:57 +000021#include "MipsSelectionDAGInfo.h"
Craig Topper79aa3412012-03-17 18:46:09 +000022#include "MipsSubtarget.h"
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000023#include "llvm/Target/TargetMachine.h"
24#include "llvm/Target/TargetData.h"
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000025#include "llvm/Target/TargetFrameLowering.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);
Akira Hatanaka864f6602012-06-14 21:10:56 +000072 virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &JCE);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000073 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000074
Akira Hatanaka24648102011-09-21 03:00:58 +000075/// MipsebTargetMachine - Mips32 big endian target machine.
76///
77class MipsebTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000078 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +000079public:
80 MipsebTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000081 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000082 Reloc::Model RM, CodeModel::Model CM,
83 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +000084};
85
86/// MipselTargetMachine - Mips32 little endian target machine.
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000087///
88class MipselTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +000089 virtual void anchor();
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000090public:
Evan Cheng43966132011-07-19 06:37:02 +000091 MipselTargetMachine(const Target &T, StringRef TT,
Nick Lewycky8a8d4792011-12-02 22:16:29 +000092 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +000093 Reloc::Model RM, CodeModel::Model CM,
94 CodeGenOpt::Level OL);
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000095};
96
Akira Hatanaka4e414162011-09-22 17:26:58 +000097/// Mips64ebTargetMachine - Mips64 big endian target machine.
Akira Hatanaka24648102011-09-21 03:00:58 +000098///
99class Mips64ebTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +0000100 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +0000101public:
102 Mips64ebTargetMachine(const Target &T, StringRef TT,
103 StringRef CPU, StringRef FS,
Nick Lewycky8a8d4792011-12-02 22:16:29 +0000104 const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +0000105 Reloc::Model RM, CodeModel::Model CM,
106 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000107};
108
Akira Hatanaka4e414162011-09-22 17:26:58 +0000109/// Mips64elTargetMachine - Mips64 little endian target machine.
Akira Hatanaka24648102011-09-21 03:00:58 +0000110///
111class Mips64elTargetMachine : public MipsTargetMachine {
David Blaikie2d24e2a2011-12-20 02:50:00 +0000112 virtual void anchor();
Akira Hatanaka24648102011-09-21 03:00:58 +0000113public:
114 Mips64elTargetMachine(const Target &T, StringRef TT,
115 StringRef CPU, StringRef FS,
Nick Lewycky8a8d4792011-12-02 22:16:29 +0000116 const TargetOptions &Options,
Evan Chengb95fc312011-11-16 08:38:26 +0000117 Reloc::Model RM, CodeModel::Model CM,
118 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000119};
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000120} // End llvm namespace
121
122#endif