Adding the MicroBlaze backend.
[oota-llvm.git] / lib / Target / MBlaze / MBlazeSubtarget.h
1 //=====-- MBlazeSubtarget.h - Define Subtarget for the MBlaze -*- 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 MBlaze specific subclass of TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef MBLAZESUBTARGET_H
15 #define MBLAZESUBTARGET_H
16
17 #include "llvm/Target/TargetSubtarget.h"
18 #include "llvm/Target/TargetMachine.h"
19
20 #include <string>
21
22 namespace llvm {
23
24 class MBlazeSubtarget : public TargetSubtarget {
25
26 protected:
27
28   enum MBlazeArchEnum {
29     V400, V500, V600, V700, V710
30   };
31
32   // MBlaze architecture version
33   MBlazeArchEnum MBlazeArchVersion;
34
35   bool HasPipe3;
36   bool HasBarrel;
37   bool HasDiv;
38   bool HasMul;
39   bool HasFSL;
40   bool HasEFSL;
41   bool HasMSRSet;
42   bool HasException;
43   bool HasPatCmp;
44   bool HasFPU;
45   bool HasESR;
46   bool HasPVR;
47   bool HasMul64;
48   bool HasSqrt;
49   bool HasMMU;
50
51   InstrItineraryData InstrItins;
52
53 public:
54
55   /// This constructor initializes the data members to match that
56   /// of the specified triple.
57   MBlazeSubtarget(const std::string &TT, const std::string &FS);
58
59   /// ParseSubtargetFeatures - Parses features string setting specified
60   /// subtarget options.  Definition of function is auto generated by tblgen.
61   std::string ParseSubtargetFeatures(const std::string &FS,
62                                      const std::string &CPU);
63
64   bool hasFPU()    const { return HasFPU; }
65   bool hasSqrt()   const { return HasSqrt; }
66   bool hasMul()    const { return HasMul; }
67   bool hasMul64()  const { return HasMul64; }
68   bool hasDiv()    const { return HasDiv; }
69   bool hasBarrel() const { return HasBarrel; }
70
71   bool isV400() const { return MBlazeArchVersion == V400; }
72   bool isV500() const { return MBlazeArchVersion == V500; }
73   bool isV600() const { return MBlazeArchVersion == V600; }
74   bool isV700() const { return MBlazeArchVersion == V700; }
75   bool isV710() const { return MBlazeArchVersion == V710; }
76 };
77 } // End llvm namespace
78
79 #endif