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