blob: 421405649ab1a68e773d4c12e0974cb37109890c [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 Lopes972f5892007-06-06 07:42:06 +000025
26namespace llvm {
David Greene71847812009-07-14 20:18:05 +000027 class formatted_raw_ostream;
Anton Korobeynikov33464912010-11-15 00:06:54 +000028
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000029 class MipsTargetMachine : public LLVMTargetMachine {
30 MipsSubtarget Subtarget;
31 const TargetData DataLayout; // Calculates type size & alignment
32 MipsInstrInfo InstrInfo;
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000033 MipsFrameLowering FrameLowering;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000034 MipsTargetLowering TLInfo;
Dan Gohmanff7a5622010-05-11 17:31:57 +000035 MipsSelectionDAGInfo TSInfo;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000036 public:
Evan Cheng43966132011-07-19 06:37:02 +000037 MipsTargetMachine(const Target &T, StringRef TT,
38 StringRef CPU, StringRef FS,
Evan Cheng34ad6db2011-07-20 07:51:56 +000039 Reloc::Model RM, CodeModel::Model CM,
40 bool isLittle);
Anton Korobeynikov33464912010-11-15 00:06:54 +000041
42 virtual const MipsInstrInfo *getInstrInfo() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000043 { return &InstrInfo; }
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000044 virtual const TargetFrameLowering *getFrameLowering() const
45 { return &FrameLowering; }
Anton Korobeynikov33464912010-11-15 00:06:54 +000046 virtual const MipsSubtarget *getSubtargetImpl() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000047 { return &Subtarget; }
Anton Korobeynikov33464912010-11-15 00:06:54 +000048 virtual const TargetData *getTargetData() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000049 { return &DataLayout;}
50
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000051 virtual const MipsRegisterInfo *getRegisterInfo() const {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000052 return &InstrInfo.getRegisterInfo();
53 }
54
Anton Korobeynikov33464912010-11-15 00:06:54 +000055 virtual const MipsTargetLowering *getTargetLowering() const {
Dan Gohmand858e902010-04-17 15:26:15 +000056 return &TLInfo;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000057 }
58
Dan Gohmanff7a5622010-05-11 17:31:57 +000059 virtual const MipsSelectionDAGInfo* getSelectionDAGInfo() const {
60 return &TSInfo;
61 }
62
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000063 // Pass Pipeline Configuration
Bill Wendling98a366d2009-04-29 23:29:43 +000064 virtual bool addInstSelector(PassManagerBase &PM,
65 CodeGenOpt::Level OptLevel);
66 virtual bool addPreEmitPass(PassManagerBase &PM,
67 CodeGenOpt::Level OptLevel);
Akira Hatanaka6b7588e2011-05-04 17:54:27 +000068 virtual bool addPreRegAlloc(PassManagerBase &PM,
69 CodeGenOpt::Level OptLevel);
Akira Hatanaka99a2e982011-04-15 19:52:08 +000070 virtual bool addPostRegAlloc(PassManagerBase &, CodeGenOpt::Level);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000071 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000072
73/// MipselTargetMachine - Mipsel target machine.
74///
75class MipselTargetMachine : public MipsTargetMachine {
76public:
Evan Cheng43966132011-07-19 06:37:02 +000077 MipselTargetMachine(const Target &T, StringRef TT,
Evan Cheng34ad6db2011-07-20 07:51:56 +000078 StringRef CPU, StringRef FS,
79 Reloc::Model RM, CodeModel::Model CM);
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000080};
81
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000082} // End llvm namespace
83
84#endif