blob: 8c9bcd36bf339b52c93baacae9c02532e27acabf [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 Korobeynikov2f931282011-01-10 12:39:04 +000017#include "SparcFrameLowering.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000018#include "SparcISelLowering.h"
19#include "SparcInstrInfo.h"
Venkatraman Govindaraju2ea4c282013-10-08 07:15:22 +000020#include "SparcJITInfo.h"
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000021#include "SparcSelectionDAGInfo.h"
22#include "SparcSubtarget.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000023#include "llvm/IR/DataLayout.h"
Anton Korobeynikov2f931282011-01-10 12:39:04 +000024#include "llvm/Target/TargetFrameLowering.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000025#include "llvm/Target/TargetMachine.h"
Chris Lattner158e1f52006-02-05 05:50:24 +000026
27namespace llvm {
28
Chris Lattner12e97302006-09-04 04:14:57 +000029class SparcTargetMachine : public LLVMTargetMachine {
Chris Lattner158e1f52006-02-05 05:50:24 +000030 SparcSubtarget Subtarget;
Micah Villmowcdfe20b2012-10-08 16:38:25 +000031 const DataLayout DL; // Calculates type size & alignment
Jakob Stoklund Olesen34a8f132012-05-04 02:16:39 +000032 SparcInstrInfo InstrInfo;
Dan Gohman2c836cf2008-10-03 16:55:19 +000033 SparcTargetLowering TLInfo;
Dan Gohmanbb919df2010-05-11 17:31:57 +000034 SparcSelectionDAGInfo TSInfo;
Anton Korobeynikov2f931282011-01-10 12:39:04 +000035 SparcFrameLowering FrameLowering;
Venkatraman Govindaraju2ea4c282013-10-08 07:15:22 +000036 SparcJITInfo JITInfo;
Chris Lattner158e1f52006-02-05 05:50:24 +000037public:
Evan Cheng2129f592011-07-19 06:37:02 +000038 SparcTargetMachine(const Target &T, StringRef TT,
Nick Lewycky50f02cb2011-12-02 22:16:29 +000039 StringRef CPU, StringRef FS, const TargetOptions &Options,
Evan Chengecb29082011-11-16 08:38:26 +000040 Reloc::Model RM, CodeModel::Model CM,
Nick Lewycky50f02cb2011-12-02 22:16:29 +000041 CodeGenOpt::Level OL, bool is64bit);
Chris Lattner158e1f52006-02-05 05:50:24 +000042
43 virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
Anton Korobeynikov2f931282011-01-10 12:39:04 +000044 virtual const TargetFrameLowering *getFrameLowering() const {
45 return &FrameLowering;
46 }
Dan Gohmaneabd6472008-05-14 01:58:56 +000047 virtual const SparcSubtarget *getSubtargetImpl() const{ return &Subtarget; }
48 virtual const SparcRegisterInfo *getRegisterInfo() const {
Chris Lattner158e1f52006-02-05 05:50:24 +000049 return &InstrInfo.getRegisterInfo();
50 }
Dan Gohman21cea8a2010-04-17 15:26:15 +000051 virtual const SparcTargetLowering* getTargetLowering() const {
52 return &TLInfo;
Dan Gohman2c836cf2008-10-03 16:55:19 +000053 }
Dan Gohmanbb919df2010-05-11 17:31:57 +000054 virtual const SparcSelectionDAGInfo* getSelectionDAGInfo() const {
55 return &TSInfo;
56 }
Venkatraman Govindaraju2ea4c282013-10-08 07:15:22 +000057 virtual SparcJITInfo *getJITInfo() {
58 return &JITInfo;
59 }
Micah Villmowcdfe20b2012-10-08 16:38:25 +000060 virtual const DataLayout *getDataLayout() const { return &DL; }
Chris Lattner158e1f52006-02-05 05:50:24 +000061
Chris Lattner12e97302006-09-04 04:14:57 +000062 // Pass Pipeline Configuration
Andrew Trickf8ea1082012-02-04 02:56:59 +000063 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
Venkatraman Govindaraju2ea4c282013-10-08 07:15:22 +000064 virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &JCE);
Chris Lattner158e1f52006-02-05 05:50:24 +000065};
66
Chris Lattner8228b112010-02-04 06:34:01 +000067/// SparcV8TargetMachine - Sparc 32-bit target machine
68///
69class SparcV8TargetMachine : public SparcTargetMachine {
David Blaikiea379b1812011-12-20 02:50:00 +000070 virtual void anchor();
Chris Lattner8228b112010-02-04 06:34:01 +000071public:
Evan Cheng2129f592011-07-19 06:37:02 +000072 SparcV8TargetMachine(const Target &T, StringRef TT,
Evan Chengefd9b422011-07-20 07:51:56 +000073 StringRef CPU, StringRef FS,
Nick Lewycky50f02cb2011-12-02 22:16:29 +000074 const TargetOptions &Options,
Evan Chengecb29082011-11-16 08:38:26 +000075 Reloc::Model RM, CodeModel::Model CM,
76 CodeGenOpt::Level OL);
Chris Lattner8228b112010-02-04 06:34:01 +000077};
78
79/// SparcV9TargetMachine - Sparc 64-bit target machine
80///
81class SparcV9TargetMachine : public SparcTargetMachine {
David Blaikiea379b1812011-12-20 02:50:00 +000082 virtual void anchor();
Chris Lattner8228b112010-02-04 06:34:01 +000083public:
Evan Cheng2129f592011-07-19 06:37:02 +000084 SparcV9TargetMachine(const Target &T, StringRef TT,
Evan Chengefd9b422011-07-20 07:51:56 +000085 StringRef CPU, StringRef FS,
Nick Lewycky50f02cb2011-12-02 22:16:29 +000086 const TargetOptions &Options,
Evan Chengecb29082011-11-16 08:38:26 +000087 Reloc::Model RM, CodeModel::Model CM,
88 CodeGenOpt::Level OL);
Chris Lattner8228b112010-02-04 06:34:01 +000089};
90
Chris Lattner158e1f52006-02-05 05:50:24 +000091} // end namespace llvm
92
93#endif