• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //==-- llvm/Target/TargetSelectionDAGInfo.h - SelectionDAG Info --*- 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 declares the TargetSelectionDAGInfo class, which targets can
11 // subclass to parameterize the SelectionDAG lowering and instruction
12 // selection process.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_TARGET_TARGETSELECTIONDAGINFO_H
17 #define LLVM_TARGET_TARGETSELECTIONDAGINFO_H
18 
19 #include "llvm/CodeGen/SelectionDAGNodes.h"
20 
21 namespace llvm {
22 
23 class TargetData;
24 class TargetMachine;
25 
26 //===----------------------------------------------------------------------===//
27 /// TargetSelectionDAGInfo - Targets can subclass this to parameterize the
28 /// SelectionDAG lowering and instruction selection process.
29 ///
30 class TargetSelectionDAGInfo {
31   TargetSelectionDAGInfo(const TargetSelectionDAGInfo &); // DO NOT IMPLEMENT
32   void operator=(const TargetSelectionDAGInfo &);         // DO NOT IMPLEMENT
33 
34   const TargetData *TD;
35 
36 protected:
getTargetData()37   const TargetData *getTargetData() const { return TD; }
38 
39 public:
40   explicit TargetSelectionDAGInfo(const TargetMachine &TM);
41   virtual ~TargetSelectionDAGInfo();
42 
43   /// EmitTargetCodeForMemcpy - Emit target-specific code that performs a
44   /// memcpy. This can be used by targets to provide code sequences for cases
45   /// that don't fit the target's parameters for simple loads/stores and can be
46   /// more efficient than using a library call. This function can return a null
47   /// SDValue if the target declines to use custom code and a different
48   /// lowering strategy should be used.
49   ///
50   /// If AlwaysInline is true, the size is constant and the target should not
51   /// emit any calls and is strongly encouraged to attempt to emit inline code
52   /// even if it is beyond the usual threshold because this intrinsic is being
53   /// expanded in a place where calls are not feasible (e.g. within the prologue
54   /// for another call). If the target chooses to decline an AlwaysInline
55   /// request here, legalize will resort to using simple loads and stores.
56   virtual SDValue
EmitTargetCodeForMemcpy(SelectionDAG & DAG,DebugLoc dl,SDValue Chain,SDValue Op1,SDValue Op2,SDValue Op3,unsigned Align,bool isVolatile,bool AlwaysInline,MachinePointerInfo DstPtrInfo,MachinePointerInfo SrcPtrInfo)57   EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
58                           SDValue Chain,
59                           SDValue Op1, SDValue Op2,
60                           SDValue Op3, unsigned Align, bool isVolatile,
61                           bool AlwaysInline,
62                           MachinePointerInfo DstPtrInfo,
63                           MachinePointerInfo SrcPtrInfo) const {
64     return SDValue();
65   }
66 
67   /// EmitTargetCodeForMemmove - Emit target-specific code that performs a
68   /// memmove. This can be used by targets to provide code sequences for cases
69   /// that don't fit the target's parameters for simple loads/stores and can be
70   /// more efficient than using a library call. This function can return a null
71   /// SDValue if the target declines to use custom code and a different
72   /// lowering strategy should be used.
73   virtual SDValue
EmitTargetCodeForMemmove(SelectionDAG & DAG,DebugLoc dl,SDValue Chain,SDValue Op1,SDValue Op2,SDValue Op3,unsigned Align,bool isVolatile,MachinePointerInfo DstPtrInfo,MachinePointerInfo SrcPtrInfo)74   EmitTargetCodeForMemmove(SelectionDAG &DAG, DebugLoc dl,
75                            SDValue Chain,
76                            SDValue Op1, SDValue Op2,
77                            SDValue Op3, unsigned Align, bool isVolatile,
78                            MachinePointerInfo DstPtrInfo,
79                            MachinePointerInfo SrcPtrInfo) const {
80     return SDValue();
81   }
82 
83   /// EmitTargetCodeForMemset - Emit target-specific code that performs a
84   /// memset. This can be used by targets to provide code sequences for cases
85   /// that don't fit the target's parameters for simple stores and can be more
86   /// efficient than using a library call. This function can return a null
87   /// SDValue if the target declines to use custom code and a different
88   /// lowering strategy should be used.
89   virtual SDValue
EmitTargetCodeForMemset(SelectionDAG & DAG,DebugLoc dl,SDValue Chain,SDValue Op1,SDValue Op2,SDValue Op3,unsigned Align,bool isVolatile,MachinePointerInfo DstPtrInfo)90   EmitTargetCodeForMemset(SelectionDAG &DAG, DebugLoc dl,
91                           SDValue Chain,
92                           SDValue Op1, SDValue Op2,
93                           SDValue Op3, unsigned Align, bool isVolatile,
94                           MachinePointerInfo DstPtrInfo) const {
95     return SDValue();
96   }
97 };
98 
99 } // end llvm namespace
100 
101 #endif
102