blob: b11fdd5dba50341eb70152c5964e2919be55996a [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"
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000020#include "PIC16RegisterInfo.h"
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000021#include "PIC16Subtarget.h"
22#include "llvm/Target/TargetData.h"
23#include "llvm/Target/TargetFrameInfo.h"
24#include "llvm/Target/TargetMachine.h"
25
26namespace llvm {
27
28/// PIC16TargetMachine
29///
30class PIC16TargetMachine : public LLVMTargetMachine {
31 PIC16Subtarget Subtarget;
32 const TargetData DataLayout; // Calculates type size & alignment
33 PIC16InstrInfo InstrInfo;
34 PIC16TargetLowering TLInfo;
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000035
36 // PIC16 does not have any call stack frame, therefore not having
37 // any PIC16 specific FrameInfo class.
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000038 TargetFrameInfo FrameInfo;
39
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000040public:
Daniel Dunbarf5c2b852009-08-02 23:37:13 +000041 PIC16TargetMachine(const Target &T, const std::string &TT,
42 const std::string &FS, bool Cooper = false);
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000043
44 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
45 virtual const PIC16InstrInfo *getInstrInfo() const { return &InstrInfo; }
46 virtual const TargetData *getTargetData() const { return &DataLayout;}
47 virtual const PIC16Subtarget *getSubtargetImpl() const { return &Subtarget; }
48
49 virtual const PIC16RegisterInfo *getRegisterInfo() const {
50 return &(InstrInfo.getRegisterInfo());
51 }
52
53 virtual PIC16TargetLowering *getTargetLowering() const {
54 return const_cast<PIC16TargetLowering*>(&TLInfo);
55 }
56
Bill Wendling5ed22ac2009-04-29 23:29:43 +000057 virtual bool addInstSelector(PassManagerBase &PM,
58 CodeGenOpt::Level OptLevel);
Sanjiv Gupta0e758c82009-08-07 05:44:27 +000059 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
Sanjiv Gupta085ae4f2008-11-19 11:00:54 +000060}; // PIC16TargetMachine.
61
Sanjiv Gupta09bb4202008-05-13 09:02:57 +000062} // end namespace llvm
63
64#endif