TableGen subtarget emitter. Remove unnecessary header dependence.
[oota-llvm.git] / include / llvm / Target / TargetSubtargetInfo.h
1 //==-- llvm/Target/TargetSubtargetInfo.h - Target Information ----*- 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 describes the subtarget options of a Target machine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TARGET_TARGETSUBTARGETINFO_H
15 #define LLVM_TARGET_TARGETSUBTARGETINFO_H
16
17 #include "llvm/MC/MCSubtargetInfo.h"
18 #include "llvm/Support/CodeGen.h"
19
20 namespace llvm {
21
22 class MachineInstr;
23 class SDep;
24 class SUnit;
25 class TargetRegisterClass;
26 class TargetSchedModel;
27 template <typename T> class SmallVectorImpl;
28
29 //===----------------------------------------------------------------------===//
30 ///
31 /// TargetSubtargetInfo - Generic base class for all target subtargets.  All
32 /// Target-specific options that control code generation and printing should
33 /// be exposed through a TargetSubtargetInfo-derived class.
34 ///
35 class TargetSubtargetInfo : public MCSubtargetInfo {
36   TargetSubtargetInfo(const TargetSubtargetInfo&) LLVM_DELETED_FUNCTION;
37   void operator=(const TargetSubtargetInfo&) LLVM_DELETED_FUNCTION;
38 protected: // Can only create subclasses...
39   TargetSubtargetInfo();
40 public:
41   // AntiDepBreakMode - Type of anti-dependence breaking that should
42   // be performed before post-RA scheduling.
43   typedef enum { ANTIDEP_NONE, ANTIDEP_CRITICAL, ANTIDEP_ALL } AntiDepBreakMode;
44   typedef SmallVectorImpl<const TargetRegisterClass*> RegClassVector;
45
46   virtual ~TargetSubtargetInfo();
47
48   /// Resolve a SchedClass at runtime, where SchedClass identifies an
49   /// MCSchedClassDesc with the isVariant property. This may return the ID of
50   /// another variant SchedClass, but repeated invocation must quickly terminate
51   /// in a nonvariant SchedClass.
52   virtual unsigned resolveSchedClass(unsigned SchedClass, const MachineInstr *MI,
53                                      const TargetSchedModel* SchedModel) const {
54     return 0;
55   }
56
57   /// getSpecialAddressLatency - For targets where it is beneficial to
58   /// backschedule instructions that compute addresses, return a value
59   /// indicating the number of scheduling cycles of backscheduling that
60   /// should be attempted.
61   virtual unsigned getSpecialAddressLatency() const { return 0; }
62
63   // enablePostRAScheduler - If the target can benefit from post-regalloc
64   // scheduling and the specified optimization level meets the requirement
65   // return true to enable post-register-allocation scheduling. In
66   // CriticalPathRCs return any register classes that should only be broken
67   // if on the critical path.
68   virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
69                                      AntiDepBreakMode& Mode,
70                                      RegClassVector& CriticalPathRCs) const;
71   // adjustSchedDependency - Perform target specific adjustments to
72   // the latency of a schedule dependency.
73   virtual void adjustSchedDependency(SUnit *def, SUnit *use,
74                                      SDep& dep) const { }
75 };
76
77 } // End llvm namespace
78
79 #endif