blob: c1671e69bbf841b3f3040d093f9213258c7af9bf [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,
39 Reloc::Model RM, bool isLittle);
Anton Korobeynikov33464912010-11-15 00:06:54 +000040
41 virtual const MipsInstrInfo *getInstrInfo() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000042 { return &InstrInfo; }
Anton Korobeynikov16c29b52011-01-10 12:39:04 +000043 virtual const TargetFrameLowering *getFrameLowering() const
44 { return &FrameLowering; }
Anton Korobeynikov33464912010-11-15 00:06:54 +000045 virtual const MipsSubtarget *getSubtargetImpl() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000046 { return &Subtarget; }
Anton Korobeynikov33464912010-11-15 00:06:54 +000047 virtual const TargetData *getTargetData() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000048 { return &DataLayout;}
49
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000050 virtual const MipsRegisterInfo *getRegisterInfo() const {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000051 return &InstrInfo.getRegisterInfo();
52 }
53
Anton Korobeynikov33464912010-11-15 00:06:54 +000054 virtual const MipsTargetLowering *getTargetLowering() const {
Dan Gohmand858e902010-04-17 15:26:15 +000055 return &TLInfo;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000056 }
57
Dan Gohmanff7a5622010-05-11 17:31:57 +000058 virtual const MipsSelectionDAGInfo* getSelectionDAGInfo() const {
59 return &TSInfo;
60 }
61
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000062 // Pass Pipeline Configuration
Bill Wendling98a366d2009-04-29 23:29:43 +000063 virtual bool addInstSelector(PassManagerBase &PM,
64 CodeGenOpt::Level OptLevel);
65 virtual bool addPreEmitPass(PassManagerBase &PM,
66 CodeGenOpt::Level OptLevel);
Akira Hatanaka6b7588e2011-05-04 17:54:27 +000067 virtual bool addPreRegAlloc(PassManagerBase &PM,
68 CodeGenOpt::Level OptLevel);
Akira Hatanaka99a2e982011-04-15 19:52:08 +000069 virtual bool addPostRegAlloc(PassManagerBase &, CodeGenOpt::Level);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000070 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000071
72/// MipselTargetMachine - Mipsel target machine.
73///
74class MipselTargetMachine : public MipsTargetMachine {
75public:
Evan Cheng43966132011-07-19 06:37:02 +000076 MipselTargetMachine(const Target &T, StringRef TT,
77 StringRef CPU, StringRef FS, Reloc::Model RM);
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000078};
79
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000080} // End llvm namespace
81
82#endif