annotate lib/Target/ARC/ARCISelLowering.h @ 121:803732b1fca8

LLVM 5.0
author kono
date Fri, 27 Oct 2017 17:07:41 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 //===- ARCISelLowering.h - ARC DAG Lowering Interface -----------*- C++ -*-===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3 // The LLVM Compiler Infrastructure
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5 // This file is distributed under the University of Illinois Open Source
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 // License. See LICENSE.TXT for details.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 // This file defines the interfaces that ARC uses to lower LLVM code into a
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 // selection DAG.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 //===----------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 #ifndef LLVM_LIB_TARGET_ARC_ARCISELLOWERING_H
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16 #define LLVM_LIB_TARGET_ARC_ARCISELLOWERING_H
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18 #include "ARC.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 #include "llvm/CodeGen/SelectionDAG.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 #include "llvm/Target/TargetLowering.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22 namespace llvm {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 // Forward delcarations
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 class ARCSubtarget;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26 class ARCTargetMachine;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28 namespace ARCISD {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 enum NodeType : unsigned {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 // Start the numbering where the builtin ops and target ops leave off.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 FIRST_NUMBER = ISD::BUILTIN_OP_END,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34 // Branch and link (call)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 BL,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 // Jump and link (indirect call)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
38 JL,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
39
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
40 // CMP
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
41 CMP,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
42
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
43 // CMOV
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
44 CMOV,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
45
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
46 // BRcc
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
47 BRcc,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
48
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
49 // Global Address Wrapper
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
50 GAWRAPPER,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
51
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
52 // return, (j_s [blink])
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
53 RET
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
54 };
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
55
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
56 } // end namespace ARCISD
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
57
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
58 //===--------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
59 // TargetLowering Implementation
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
60 //===--------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
61 class ARCTargetLowering : public TargetLowering {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
62 public:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
63 explicit ARCTargetLowering(const TargetMachine &TM,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
64 const ARCSubtarget &Subtarget);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
65
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
66 /// Provide custom lowering hooks for some operations.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
67 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
68
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
69 /// This method returns the name of a target specific DAG node.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
70 const char *getTargetNodeName(unsigned Opcode) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
71
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
72 /// Return true if the addressing mode represented by AM is legal for this
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
73 /// target, for a load/store of the specified type.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
74 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
75 unsigned AS,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
76 Instruction *I = nullptr) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
77
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
78 private:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
79 const TargetMachine &TM;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
80 const ARCSubtarget &Subtarget;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
81
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
82 // Lower Operand helpers
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
83 SDValue LowerCallArguments(SDValue Chain, CallingConv::ID CallConv,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
84 bool isVarArg,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
85 const SmallVectorImpl<ISD::InputArg> &Ins,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
86 SDLoc dl, SelectionDAG &DAG,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
87 SmallVectorImpl<SDValue> &InVals) const;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
88 // Lower Operand specifics
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
89 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
90 SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
91 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
92 SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
93 SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
94 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
95 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
96
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
97 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
98 bool isVarArg,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
99 const SmallVectorImpl<ISD::InputArg> &Ins,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
100 const SDLoc &dl, SelectionDAG &DAG,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
101 SmallVectorImpl<SDValue> &InVals) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
102
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
103 SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
104 SmallVectorImpl<SDValue> &InVals) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
105
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
106 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
107 const SmallVectorImpl<ISD::OutputArg> &Outs,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
108 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &dl,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
109 SelectionDAG &DAG) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
110
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
111 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
112 bool isVarArg,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
113 const SmallVectorImpl<ISD::OutputArg> &ArgsFlags,
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
114 LLVMContext &Context) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
115
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
116 bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
117 };
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
118
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
119 } // end namespace llvm
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
120
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
121 #endif // LLVM_LIB_TARGET_ARC_ARCISELLOWERING_H