blob: ac55647aba4e8011b78ac0a18a27de3432178fbe [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 {
Owen Andersoncb371882008-08-21 00:14:44 +000025 class raw_ostream;
26
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;
36
37 public:
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000038 MipsTargetMachine(const Module &M, const std::string &FS, bool isLittle);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000039
40 virtual const MipsInstrInfo *getInstrInfo() const
41 { return &InstrInfo; }
42 virtual const TargetFrameInfo *getFrameInfo() const
43 { return &FrameInfo; }
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000044 virtual const MipsSubtarget *getSubtargetImpl() const
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000045 { return &Subtarget; }
46 virtual const TargetData *getTargetData() const
47 { return &DataLayout;}
48
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000049 virtual const MipsRegisterInfo *getRegisterInfo() const {
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000050 return &InstrInfo.getRegisterInfo();
51 }
52
53 virtual MipsTargetLowering *getTargetLowering() const {
54 return const_cast<MipsTargetLowering*>(&TLInfo);
55 }
56
57 static unsigned getModuleMatchQuality(const Module &M);
58
59 // Pass Pipeline Configuration
Dan Gohmanbfae8312008-03-11 22:29:46 +000060 virtual bool addInstSelector(PassManagerBase &PM, bool Fast);
61 virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast);
62 virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast,
Owen Andersoncb371882008-08-21 00:14:44 +000063 raw_ostream &Out);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000064 };
Bruno Cardoso Lopesd2947ee2008-06-04 01:45:25 +000065
66/// MipselTargetMachine - Mipsel target machine.
67///
68class MipselTargetMachine : public MipsTargetMachine {
69public:
70 MipselTargetMachine(const Module &M, const std::string &FS);
71
72 static unsigned getModuleMatchQuality(const Module &M);
73};
74
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000075} // End llvm namespace
76
77#endif