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 "llvm/Pass.h"
12 #include "Support/NonCopyable.h"
14 class MachineInstrInfo;
15 class MachineInstrDescriptor;
16 class MachineSchedInfo;
18 class MachineFrameInfo;
19 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 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,
49 virtual ~TargetMachine() {}
52 // Interfaces to the major aspects of target machine information:
53 // -- Instruction opcode and operand information
54 // -- Pipelines and scheduling information
55 // -- Register information
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;
64 // Data storage information
66 virtual unsigned int findOptimalStorageSize (const Type* ty) const;
69 // addPassesToEmitAssembly - Add passes to the specified pass manager to get
70 // assembly langage code emited. Typically this will involve several steps of
73 virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) = 0;