blob: e2b83b721fcc1ce1b3234c521ae2b090ea73c5c1 [file] [log] [blame]
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00001//===-- MipsTargetMachine.h - Define TargetMachine for Mips -00--*- C++ -*-===//
2//
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//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the Mips specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MIPSTARGETMACHINE_H
15#define MIPSTARGETMACHINE_H
16
17#include "MipsSubtarget.h"
18#include "MipsInstrInfo.h"
19#include "MipsISelLowering.h"
20#include "llvm/Target/TargetMachine.h"
21#include "llvm/Target/TargetData.h"
22#include "llvm/Target/TargetFrameInfo.h"
23
24namespace llvm {
David Greene71847812009-07-14 20:18:05 +000025 class formatted_raw_ostream;
Owen Andersoncb371882008-08-21 00:14:44 +000026
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000027 class MipsTargetMachine : public LLVMTargetMachine {
28 MipsSubtarget Subtarget;
29 const TargetData DataLayout; // Calculates type size & alignment
30 MipsInstrInfo InstrInfo;
31 TargetFrameInfo FrameInfo;
32 MipsTargetLowering TLInfo;
33
34 protected:
35 virtual const TargetAsmInfo *createTargetAsmInfo() const;
Chris Lattnere8f10182009-06-16 22:38:04 +000036
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000037 public:
Daniel Dunbare28039c2009-08-02 23:37:13 +000038 MipsTargetMachine(const Target &T, const Module &M,
39 const std::string &FS, bool isLittle);
Chris Lattnere8f10182009-06-16 22:38:04 +000040
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000041 virtual const MipsInstrInfo *getInstrInfo() const
42 { return &InstrInfo; }
43 virtual const TargetFrameInfo *getFrameInfo() const
44 { return &FrameInfo; }
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000045 virtual const MipsSubtarget *getSubtargetImpl() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000046 { return &Subtarget; }
47 virtual const TargetData *getTargetData() const
48 { 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
54 virtual MipsTargetLowering *getTargetLowering() const {
55 return const_cast<MipsTargetLowering*>(&TLInfo);
56 }
57
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000058 // Pass Pipeline Configuration
Bill Wendling98a366d2009-04-29 23:29:43 +000059 virtual bool addInstSelector(PassManagerBase &PM,
60 CodeGenOpt::Level OptLevel);
61 virtual bool addPreEmitPass(PassManagerBase &PM,
62 CodeGenOpt::Level OptLevel);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000063 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000064
65/// MipselTargetMachine - Mipsel target machine.
66///
67class MipselTargetMachine : public MipsTargetMachine {
68public:
Daniel Dunbar51b198a2009-07-15 20:24:03 +000069 MipselTargetMachine(const Target &T, const Module &M, const std::string &FS);
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000070};
71
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000072} // End llvm namespace
73
74#endif