15b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng//==-- llvm/Target/TargetSubtargetInfo.h - Target Information ----*- C++ -*-==//
2fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//
3fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//                     The LLVM Compiler Infrastructure
4fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//
57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source
67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details.
7fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//
8fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//===----------------------------------------------------------------------===//
9fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//
10fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman// This file describes the subtarget options of a Target machine.
11fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//
12fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//===----------------------------------------------------------------------===//
13fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman
145b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng#ifndef LLVM_TARGET_TARGETSUBTARGETINFO_H
155b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng#define LLVM_TARGET_TARGETSUBTARGETINFO_H
16fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman
1794214703d97d8d9dfca88174ffc7e94820a85e62Evan Cheng#include "llvm/MC/MCSubtargetInfo.h"
186c01492ac40bed9529a2f7c8d40da34b8f04365eCraig Topper#include "llvm/Support/CodeGen.h"
19fa16354e0370fe884830286923352268b036737dEvan Cheng
20fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begemannamespace llvm {
21fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman
22710461688bba935f0ad5c75da7fec2ad0f225c00David Goodwinclass SDep;
23dc4bdcdef1c8dd1a28b82deb08df039e5c0ffc5aDavid Goodwinclass SUnit;
24c2e8a7e8d2ab156afaa8ab0d0317dd9ee3db7d30David Goodwinclass TargetRegisterClass;
25c2e8a7e8d2ab156afaa8ab0d0317dd9ee3db7d30David Goodwintemplate <typename T> class SmallVectorImpl;
26710461688bba935f0ad5c75da7fec2ad0f225c00David Goodwin
27fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman//===----------------------------------------------------------------------===//
28fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman///
295b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng/// TargetSubtargetInfo - Generic base class for all target subtargets.  All
30fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman/// Target-specific options that control code generation and printing should
315b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng/// be exposed through a TargetSubtargetInfo-derived class.
32fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman///
335b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Chengclass TargetSubtargetInfo : public MCSubtargetInfo {
345b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng  TargetSubtargetInfo(const TargetSubtargetInfo&);   // DO NOT IMPLEMENT
355b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng  void operator=(const TargetSubtargetInfo&);  // DO NOT IMPLEMENT
36fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begemanprotected: // Can only create subclasses...
375b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng  TargetSubtargetInfo();
38fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begemanpublic:
394c3715c2e5e17d7216a96ac2baf9720630f04408David Goodwin  // AntiDepBreakMode - Type of anti-dependence breaking that should
404c3715c2e5e17d7216a96ac2baf9720630f04408David Goodwin  // be performed before post-RA scheduling.
414c3715c2e5e17d7216a96ac2baf9720630f04408David Goodwin  typedef enum { ANTIDEP_NONE, ANTIDEP_CRITICAL, ANTIDEP_ALL } AntiDepBreakMode;
4244d23825d61d530b8d562329ec8fc2d4f843bb8dCraig Topper  typedef SmallVectorImpl<const TargetRegisterClass*> RegClassVector;
434c3715c2e5e17d7216a96ac2baf9720630f04408David Goodwin
445b1b4489cf3a0f56f8be0673fc5cc380a32d277bEvan Cheng  virtual ~TargetSubtargetInfo();
458749b61178228ba1fb2668034d79da1b247173d7Dan Gohman
468749b61178228ba1fb2668034d79da1b247173d7Dan Gohman  /// getSpecialAddressLatency - For targets where it is beneficial to
478749b61178228ba1fb2668034d79da1b247173d7Dan Gohman  /// backschedule instructions that compute addresses, return a value
488749b61178228ba1fb2668034d79da1b247173d7Dan Gohman  /// indicating the number of scheduling cycles of backscheduling that
498749b61178228ba1fb2668034d79da1b247173d7Dan Gohman  /// should be attempted.
508749b61178228ba1fb2668034d79da1b247173d7Dan Gohman  virtual unsigned getSpecialAddressLatency() const { return 0; }
51710461688bba935f0ad5c75da7fec2ad0f225c00David Goodwin
52fa16354e0370fe884830286923352268b036737dEvan Cheng  // enablePostRAScheduler - If the target can benefit from post-regalloc
53fa16354e0370fe884830286923352268b036737dEvan Cheng  // scheduling and the specified optimization level meets the requirement
5487d21b92fc42f6b3bd8567a83fc5b5191c1205e5David Goodwin  // return true to enable post-register-allocation scheduling. In
5587d21b92fc42f6b3bd8567a83fc5b5191c1205e5David Goodwin  // CriticalPathRCs return any register classes that should only be broken
5687d21b92fc42f6b3bd8567a83fc5b5191c1205e5David Goodwin  // if on the critical path.
574c3715c2e5e17d7216a96ac2baf9720630f04408David Goodwin  virtual bool enablePostRAScheduler(CodeGenOpt::Level OptLevel,
580855dee564f80160abf95497475306af38ab7f84David Goodwin                                     AntiDepBreakMode& Mode,
5987d21b92fc42f6b3bd8567a83fc5b5191c1205e5David Goodwin                                     RegClassVector& CriticalPathRCs) const;
60710461688bba935f0ad5c75da7fec2ad0f225c00David Goodwin  // adjustSchedDependency - Perform target specific adjustments to
61710461688bba935f0ad5c75da7fec2ad0f225c00David Goodwin  // the latency of a schedule dependency.
62dc4bdcdef1c8dd1a28b82deb08df039e5c0ffc5aDavid Goodwin  virtual void adjustSchedDependency(SUnit *def, SUnit *use,
630dad89fa94536284d51f60868326294b725a0c61David Goodwin                                     SDep& dep) const { }
64fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman};
65fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman
66fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman} // End llvm namespace
67fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman
68fb5792f416089d8d8d0c6ee62c1f41a55d2cf75dNate Begeman#endif
69