SparcTargetMachine.h revision a0f3d17daac73c9c71aad497b298cbe82848f726
1//===-- SparcTargetMachine.h - Define TargetMachine for Sparc ---*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the Sparc specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SPARCTARGETMACHINE_H
15#define SPARCTARGETMACHINE_H
16
17#include "llvm/Target/TargetMachine.h"
18#include "llvm/Target/TargetData.h"
19#include "llvm/Target/TargetFrameInfo.h"
20#include "SparcInstrInfo.h"
21#include "SparcSubtarget.h"
22#include "SparcTargetAsmInfo.h"
23
24namespace llvm {
25
26class Module;
27
28class SparcTargetMachine : public LLVMTargetMachine {
29  const TargetData DataLayout;       // Calculates type size & alignment
30  SparcSubtarget Subtarget;
31  SparcInstrInfo InstrInfo;
32  TargetFrameInfo FrameInfo;
33public:
34  SparcTargetMachine(const Module &M, const std::string &FS);
35
36  virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
37  virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
38  virtual const TargetSubtarget  *getSubtargetImpl() const{ return &Subtarget; }
39  virtual const MRegisterInfo *getRegisterInfo() const {
40    return &InstrInfo.getRegisterInfo();
41  }
42  virtual const TargetData       *getTargetData() const { return &DataLayout; }
43  static unsigned getModuleMatchQuality(const Module &M);
44
45  virtual const TargetAsmInfo *createTargetAsmInfo() const {
46    return static_cast<const TargetAsmInfo *>(new SparcTargetAsmInfo(*this));
47  }
48
49  // Pass Pipeline Configuration
50  virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
51  virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast);
52  virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
53                                  std::ostream &Out);
54};
55
56} // end namespace llvm
57
58#endif
59