blob: dae5d3129c635d34d3cd991c9ca11e529801cc33 [file] [log] [blame]
Sanjiv Gupta09bb4202008-05-13 09:02:57 +00001//===-- PIC16TargetMachine.h - Define TargetMachine for PIC16 ---*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the PIC16 specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14
15#ifndef PIC16_TARGETMACHINE_H
16#define PIC16_TARGETMACHINE_H
17
18#include "PIC16InstrInfo.h"
19#include "PIC16ISelLowering.h"
Dan Gohmancfbb3232010-05-11 17:31:57 +000020#include "PIC16SelectionDAGInfo.h"
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000021#include "PIC16RegisterInfo.h"
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000022#include "PIC16Subtarget.h"
23#include "llvm/Target/TargetData.h"
24#include "llvm/Target/TargetFrameInfo.h"
25#include "llvm/Target/TargetMachine.h"
26
27namespace llvm {
28
29/// PIC16TargetMachine
30///
31class PIC16TargetMachine : public LLVMTargetMachine {
32 PIC16Subtarget Subtarget;
33 const TargetData DataLayout; // Calculates type size & alignment
34 PIC16InstrInfo InstrInfo;
35 PIC16TargetLowering TLInfo;
Dan Gohmancfbb3232010-05-11 17:31:57 +000036 PIC16SelectionDAGInfo TSInfo;
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000037
38 // PIC16 does not have any call stack frame, therefore not having
39 // any PIC16 specific FrameInfo class.
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000040 TargetFrameInfo FrameInfo;
41
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000042public:
Daniel Dunbarf5c2b852009-08-02 23:37:13 +000043 PIC16TargetMachine(const Target &T, const std::string &TT,
44 const std::string &FS, bool Cooper = false);
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000045
46 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
47 virtual const PIC16InstrInfo *getInstrInfo() const { return &InstrInfo; }
48 virtual const TargetData *getTargetData() const { return &DataLayout;}
49 virtual const PIC16Subtarget *getSubtargetImpl() const { return &Subtarget; }
50
51 virtual const PIC16RegisterInfo *getRegisterInfo() const {
52 return &(InstrInfo.getRegisterInfo());
53 }
54
Dan Gohmandbb121b2010-04-17 15:26:15 +000055 virtual const PIC16TargetLowering *getTargetLowering() const {
56 return &TLInfo;
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000057 }
58
Dan Gohmancfbb3232010-05-11 17:31:57 +000059 virtual const PIC16SelectionDAGInfo* getSelectionDAGInfo() const {
60 return &TSInfo;
61 }
62
Bill Wendling5ed22ac2009-04-29 23:29:43 +000063 virtual bool addInstSelector(PassManagerBase &PM,
64 CodeGenOpt::Level OptLevel);
Sanjiv Gupta0e758c82009-08-07 05:44:27 +000065 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000066}; // PIC16TargetMachine.
67
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000068} // end namespace llvm
69
70#endif