Add integer register size field.
[oota-llvm.git] / include / llvm / Target / TargetMachine.h
1 //===-- llvm/Target/Machine.h - General Target Information -------*- C++ -*-==//
2 //
3 // This file describes the general parts of a Target machine.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #ifndef LLVM_TARGET_TARGETMACHINE_H
8 #define LLVM_TARGET_TARGETMACHINE_H
9
10 #include "llvm/Target/TargetData.h"
11 #include "Support/NonCopyable.h"
12
13 class MachineInstrInfo;
14 class MachineInstrDescriptor;
15 class MachineSchedInfo;
16 class MachineRegInfo;
17 class MachineFrameInfo;
18 class MachineCacheInfo;
19 class PassManager;
20
21 //---------------------------------------------------------------------------
22 // class TargetMachine
23 // 
24 // Purpose:
25 //   Primary interface to the complete machine description for the
26 //   target machine.  All target-specific information should be
27 //   accessible through this interface.
28 // 
29 //---------------------------------------------------------------------------
30
31 class TargetMachine : public NonCopyableV {
32 public:
33   const std::string TargetName;
34   const TargetData DataLayout;          // Calculates type size & alignment
35   int              optSizeForSubWordData;
36   int              minMemOpWordSize;
37   int              maxAtomicMemOpWordSize;
38   
39 protected:
40   TargetMachine(const std::string &targetname, // Can only create subclasses...
41                 unsigned char PtrSize = 8, unsigned char PtrAl = 8,
42                 unsigned char DoubleAl = 8, unsigned char FloatAl = 4,
43                 unsigned char LongAl = 8, unsigned char IntAl = 4,
44                 unsigned char ShortAl = 2, unsigned char ByteAl = 1)
45     : TargetName(targetname), DataLayout(targetname, PtrSize, PtrAl,
46                                          DoubleAl, FloatAl, LongAl, IntAl, 
47                                          ShortAl, ByteAl) { }
48 public:
49   virtual ~TargetMachine() {}
50   
51   // 
52   // Interfaces to the major aspects of target machine information:
53   // -- Instruction opcode and operand information
54   // -- Pipelines and scheduling information
55   // -- Register information
56   // 
57   virtual const MachineInstrInfo&       getInstrInfo() const = 0;
58   virtual const MachineSchedInfo&       getSchedInfo() const = 0;
59   virtual const MachineRegInfo&         getRegInfo()   const = 0;
60   virtual const MachineFrameInfo&       getFrameInfo() const = 0;
61   virtual const MachineCacheInfo&       getCacheInfo() const = 0;
62   
63   //
64   // Data storage information
65   // 
66   virtual unsigned int  findOptimalStorageSize  (const Type* ty) const;
67   
68   //
69   // addPassesToEmitAssembly - Add passes to the specified pass manager to get
70   // assembly langage code emited.  Typically this will involve several steps of
71   // code generation.
72   //
73   virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) = 0;
74 };
75
76 #endif