TargetSelectionDAGInfo.h revision 001d3dc976d7cda8a3dd8c7fd4020b0b96033f4e
18c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//==-- llvm/Target/TargetSelectionDAGInfo.h - SelectionDAG Info --*- C++ -*-==//
28c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//
38c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//                     The LLVM Compiler Infrastructure
48c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//
58c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman// This file is distributed under the University of Illinois Open Source
68c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman// License. See LICENSE.TXT for details.
78c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//
88c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//===----------------------------------------------------------------------===//
98c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//
108c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman// This file declares the TargetSelectionDAGInfo class, which targets can
118c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman// subclass to parameterize the SelectionDAG lowering and instruction
128c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman// selection process.
138c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//
148c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//===----------------------------------------------------------------------===//
158c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman
168c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman#ifndef LLVM_TARGET_TARGETSELECTIONDAGINFO_H
178c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman#define LLVM_TARGET_TARGETSELECTIONDAGINFO_H
188c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman
19ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman#include "llvm/CodeGen/SelectionDAGNodes.h"
20ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman
218c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohmannamespace llvm {
228c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman
23ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohmanclass TargetData;
24ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohmanclass TargetMachine;
25ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman
268c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman//===----------------------------------------------------------------------===//
2717c4a621fe61a70b106548d168271f37fce1e89dDan Gohman/// TargetSelectionDAGInfo - Targets can subclass this to parameterize the
288c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman/// SelectionDAG lowering and instruction selection process.
298c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman///
308c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohmanclass TargetSelectionDAGInfo {
31001d3dc976d7cda8a3dd8c7fd4020b0b96033f4eCraig Topper  TargetSelectionDAGInfo(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION;
32001d3dc976d7cda8a3dd8c7fd4020b0b96033f4eCraig Topper  void operator=(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION;
338c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman
34ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  const TargetData *TD;
35ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman
36ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohmanprotected:
37ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  const TargetData *getTargetData() const { return TD; }
38ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman
398c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohmanpublic:
40ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  explicit TargetSelectionDAGInfo(const TargetMachine &TM);
418c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman  virtual ~TargetSelectionDAGInfo();
42ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman
43ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// EmitTargetCodeForMemcpy - Emit target-specific code that performs a
44ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// memcpy. This can be used by targets to provide code sequences for cases
45ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// that don't fit the target's parameters for simple loads/stores and can be
46ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// more efficient than using a library call. This function can return a null
47ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// SDValue if the target declines to use custom code and a different
48ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// lowering strategy should be used.
49ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  ///
50ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// If AlwaysInline is true, the size is constant and the target should not
51ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// emit any calls and is strongly encouraged to attempt to emit inline code
52ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// even if it is beyond the usual threshold because this intrinsic is being
53ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// expanded in a place where calls are not feasible (e.g. within the prologue
54ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// for another call). If the target chooses to decline an AlwaysInline
55ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// request here, legalize will resort to using simple loads and stores.
56ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  virtual SDValue
57ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
58ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                          SDValue Chain,
59ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                          SDValue Op1, SDValue Op2,
60ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                          SDValue Op3, unsigned Align, bool isVolatile,
61ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                          bool AlwaysInline,
62e72f2027e9116c55a5b39ac72732df8d6c45d37cChris Lattner                          MachinePointerInfo DstPtrInfo,
63e72f2027e9116c55a5b39ac72732df8d6c45d37cChris Lattner                          MachinePointerInfo SrcPtrInfo) const {
64ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman    return SDValue();
65ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  }
66ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman
67ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// EmitTargetCodeForMemmove - Emit target-specific code that performs a
68ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// memmove. This can be used by targets to provide code sequences for cases
69ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// that don't fit the target's parameters for simple loads/stores and can be
70ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// more efficient than using a library call. This function can return a null
71ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// SDValue if the target declines to use custom code and a different
72ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// lowering strategy should be used.
73ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  virtual SDValue
74ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  EmitTargetCodeForMemmove(SelectionDAG &DAG, DebugLoc dl,
75ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                           SDValue Chain,
76ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                           SDValue Op1, SDValue Op2,
77ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                           SDValue Op3, unsigned Align, bool isVolatile,
78e72f2027e9116c55a5b39ac72732df8d6c45d37cChris Lattner                           MachinePointerInfo DstPtrInfo,
79e72f2027e9116c55a5b39ac72732df8d6c45d37cChris Lattner                           MachinePointerInfo SrcPtrInfo) const {
80ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman    return SDValue();
81ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  }
82ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman
83ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// EmitTargetCodeForMemset - Emit target-specific code that performs a
84ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// memset. This can be used by targets to provide code sequences for cases
85ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// that don't fit the target's parameters for simple stores and can be more
86ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// efficient than using a library call. This function can return a null
87ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// SDValue if the target declines to use custom code and a different
88ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  /// lowering strategy should be used.
89ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  virtual SDValue
90ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  EmitTargetCodeForMemset(SelectionDAG &DAG, DebugLoc dl,
91ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                          SDValue Chain,
92ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                          SDValue Op1, SDValue Op2,
93ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman                          SDValue Op3, unsigned Align, bool isVolatile,
94e72f2027e9116c55a5b39ac72732df8d6c45d37cChris Lattner                          MachinePointerInfo DstPtrInfo) const {
95ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman    return SDValue();
96ff7a562751604a9fe13efc75bd59622244b54d35Dan Gohman  }
978c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman};
988c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman
998c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman} // end llvm namespace
1008c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman
1018c0e89925d6b76b7671fe904a97c618d155dea42Dan Gohman#endif
102