blob: c01d09ddee9b57ce0fd47ae610adfe18f8c6becb [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- SparcTargetMachine.h - Define TargetMachine for Sparc ---*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
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"
Dan Gohmanf2b29572008-10-03 16:55:19 +000022#include "SparcISelLowering.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000023
24namespace llvm {
25
26class Module;
27
28class SparcTargetMachine : public LLVMTargetMachine {
29 const TargetData DataLayout; // Calculates type size & alignment
30 SparcSubtarget Subtarget;
Dan Gohmanf2b29572008-10-03 16:55:19 +000031 SparcTargetLowering TLInfo;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000032 SparcInstrInfo InstrInfo;
33 TargetFrameInfo FrameInfo;
34
35protected:
36 virtual const TargetAsmInfo *createTargetAsmInfo() const;
37
38public:
Daniel Dunbarfe5939f2009-07-15 20:24:03 +000039 SparcTargetMachine(const Target &T, const Module &M, const std::string &FS);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000040
41 virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
42 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
Dan Gohmanb41dfba2008-05-14 01:58:56 +000043 virtual const SparcSubtarget *getSubtargetImpl() const{ return &Subtarget; }
44 virtual const SparcRegisterInfo *getRegisterInfo() const {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000045 return &InstrInfo.getRegisterInfo();
46 }
Dan Gohmanf2b29572008-10-03 16:55:19 +000047 virtual SparcTargetLowering* getTargetLowering() const {
48 return const_cast<SparcTargetLowering*>(&TLInfo);
49 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +000050 virtual const TargetData *getTargetData() const { return &DataLayout; }
Dan Gohmanf17a25c2007-07-18 16:29:46 +000051
52 // Pass Pipeline Configuration
Bill Wendling5ed22ac2009-04-29 23:29:43 +000053 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
54 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000055};
56
57} // end namespace llvm
58
59#endif