blob: 49d36bb0666af866d91f78d0815715c9153a2361 [file] [log] [blame]
Chris Lattner158e1f52006-02-05 05:50:24 +00001//===-- SparcTargetMachine.h - Define TargetMachine for Sparc ---*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattner158e1f52006-02-05 05:50:24 +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
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000017#include "SparcInstrInfo.h"
18#include "SparcISelLowering.h"
Anton Korobeynikov2f931282011-01-10 12:39:04 +000019#include "SparcFrameLowering.h"
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000020#include "SparcSelectionDAGInfo.h"
21#include "SparcSubtarget.h"
Chris Lattner158e1f52006-02-05 05:50:24 +000022#include "llvm/Target/TargetMachine.h"
Owen Anderson8c2c1e92006-05-12 06:33:49 +000023#include "llvm/Target/TargetData.h"
Anton Korobeynikov2f931282011-01-10 12:39:04 +000024#include "llvm/Target/TargetFrameLowering.h"
Chris Lattner158e1f52006-02-05 05:50:24 +000025
26namespace llvm {
27
Chris Lattner12e97302006-09-04 04:14:57 +000028class SparcTargetMachine : public LLVMTargetMachine {
Chris Lattner158e1f52006-02-05 05:50:24 +000029 SparcSubtarget Subtarget;
Chris Lattner8228b112010-02-04 06:34:01 +000030 const TargetData DataLayout; // Calculates type size & alignment
Dan Gohman2c836cf2008-10-03 16:55:19 +000031 SparcTargetLowering TLInfo;
Dan Gohmanbb919df2010-05-11 17:31:57 +000032 SparcSelectionDAGInfo TSInfo;
Chris Lattner158e1f52006-02-05 05:50:24 +000033 SparcInstrInfo InstrInfo;
Anton Korobeynikov2f931282011-01-10 12:39:04 +000034 SparcFrameLowering FrameLowering;
Chris Lattner158e1f52006-02-05 05:50:24 +000035public:
Evan Cheng2129f592011-07-19 06:37:02 +000036 SparcTargetMachine(const Target &T, StringRef TT,
37 StringRef CPU, StringRef FS,
38 Reloc::Model RM, bool is64bit);
Chris Lattner158e1f52006-02-05 05:50:24 +000039
40 virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
Anton Korobeynikov2f931282011-01-10 12:39:04 +000041 virtual const TargetFrameLowering *getFrameLowering() const {
42 return &FrameLowering;
43 }
Dan Gohmaneabd6472008-05-14 01:58:56 +000044 virtual const SparcSubtarget *getSubtargetImpl() const{ return &Subtarget; }
45 virtual const SparcRegisterInfo *getRegisterInfo() const {
Chris Lattner158e1f52006-02-05 05:50:24 +000046 return &InstrInfo.getRegisterInfo();
47 }
Dan Gohman21cea8a2010-04-17 15:26:15 +000048 virtual const SparcTargetLowering* getTargetLowering() const {
49 return &TLInfo;
Dan Gohman2c836cf2008-10-03 16:55:19 +000050 }
Dan Gohmanbb919df2010-05-11 17:31:57 +000051 virtual const SparcSelectionDAGInfo* getSelectionDAGInfo() const {
52 return &TSInfo;
53 }
Owen Anderson20a631f2006-05-03 01:29:57 +000054 virtual const TargetData *getTargetData() const { return &DataLayout; }
Chris Lattner158e1f52006-02-05 05:50:24 +000055
Chris Lattner12e97302006-09-04 04:14:57 +000056 // Pass Pipeline Configuration
Bill Wendling026e5d72009-04-29 23:29:43 +000057 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
58 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
Chris Lattner158e1f52006-02-05 05:50:24 +000059};
60
Chris Lattner8228b112010-02-04 06:34:01 +000061/// SparcV8TargetMachine - Sparc 32-bit target machine
62///
63class SparcV8TargetMachine : public SparcTargetMachine {
64public:
Evan Cheng2129f592011-07-19 06:37:02 +000065 SparcV8TargetMachine(const Target &T, StringRef TT,
66 StringRef CPU, StringRef FS, Reloc::Model RM);
Chris Lattner8228b112010-02-04 06:34:01 +000067};
68
69/// SparcV9TargetMachine - Sparc 64-bit target machine
70///
71class SparcV9TargetMachine : public SparcTargetMachine {
72public:
Evan Cheng2129f592011-07-19 06:37:02 +000073 SparcV9TargetMachine(const Target &T, StringRef TT,
74 StringRef CPU, StringRef FS, Reloc::Model RM);
Chris Lattner8228b112010-02-04 06:34:01 +000075};
76
Chris Lattner158e1f52006-02-05 05:50:24 +000077} // end namespace llvm
78
79#endif