blob: e40d9e256d9f9965be4ff845986d133d382959cb [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,
41 StringRef CPU, StringRef FS,
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
Evan Chengb95fc312011-11-16 08:38:26 +000071 virtual bool addInstSelector(PassManagerBase &PM);
72 virtual bool addPreEmitPass(PassManagerBase &PM);
73 virtual bool addPreRegAlloc(PassManagerBase &PM);
74 virtual bool addPostRegAlloc(PassManagerBase &);
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000075 virtual bool addCodeEmitter(PassManagerBase &PM,
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000076 JITCodeEmitter &JCE);
77
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000078 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000079
Akira Hatanaka24648102011-09-21 03:00:58 +000080/// MipsebTargetMachine - Mips32 big endian target machine.
81///
82class MipsebTargetMachine : public MipsTargetMachine {
83public:
84 MipsebTargetMachine(const Target &T, StringRef TT,
85 StringRef CPU, StringRef FS,
Evan Chengb95fc312011-11-16 08:38:26 +000086 Reloc::Model RM, CodeModel::Model CM,
87 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +000088};
89
90/// MipselTargetMachine - Mips32 little endian target machine.
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000091///
92class MipselTargetMachine : public MipsTargetMachine {
93public:
Evan Cheng43966132011-07-19 06:37:02 +000094 MipselTargetMachine(const Target &T, StringRef TT,
Evan Cheng34ad6db2011-07-20 07:51:56 +000095 StringRef CPU, StringRef FS,
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 {
103public:
104 Mips64ebTargetMachine(const Target &T, StringRef TT,
105 StringRef CPU, StringRef FS,
Evan Chengb95fc312011-11-16 08:38:26 +0000106 Reloc::Model RM, CodeModel::Model CM,
107 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000108};
109
Akira Hatanaka4e414162011-09-22 17:26:58 +0000110/// Mips64elTargetMachine - Mips64 little endian target machine.
Akira Hatanaka24648102011-09-21 03:00:58 +0000111///
112class Mips64elTargetMachine : public MipsTargetMachine {
113public:
114 Mips64elTargetMachine(const Target &T, StringRef TT,
115 StringRef CPU, StringRef FS,
Evan Chengb95fc312011-11-16 08:38:26 +0000116 Reloc::Model RM, CodeModel::Model CM,
117 CodeGenOpt::Level OL);
Akira Hatanaka24648102011-09-21 03:00:58 +0000118};
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +0000119} // End llvm namespace
120
121#endif