LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HexagonISelLowering.h
Go to the documentation of this file.
1 //===-- HexagonISelLowering.h - Hexagon DAG Lowering Interface --*- 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 defines the interfaces that Hexagon uses to lower LLVM code into a
11 // selection DAG.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef Hexagon_ISELLOWERING_H
16 #define Hexagon_ISELLOWERING_H
17 
18 #include "Hexagon.h"
20 #include "llvm/IR/CallingConv.h"
22 
23 namespace llvm {
24  namespace HexagonISD {
25  enum {
27 
29  CONST32_GP, // For marking data present in GP.
35 
36  CMPICC, // Compare two GPR operands, set icc.
37  CMPFCC, // Compare two FP operands, set fcc.
38  BRICC, // Branch to dest on icc condition
39  BRFCC, // Branch to dest on fcc condition
40  SELECT_ICC, // Select between two values using the current ICC flags.
41  SELECT_FCC, // Select between two values using the current FCC flags.
42 
43  Hi, Lo, // Hi/Lo operations, typically on a global address.
44 
45  FTOI, // FP to Int within a FP register.
46  ITOF, // Int to FP within a FP register.
47 
48  CALL, // A call instruction.
49  RET_FLAG, // Return with a flag operand.
50  BR_JT, // Jump table.
51  BARRIER, // Memory barrier.
67  };
68  }
69 
71  int VarArgsFrameOffset; // Frame offset to start of varargs area.
72 
73  bool CanReturnSmallStruct(const Function* CalleeFn,
74  unsigned& RetSize) const;
75 
76  public:
78  explicit HexagonTargetLowering(HexagonTargetMachine &targetmachine);
79 
80  /// IsEligibleForTailCallOptimization - Check whether the call is eligible
81  /// for tail call optimization. Targets which want to do tail call
82  /// optimization should implement this function.
83  bool
85  CallingConv::ID CalleeCC,
86  bool isVarArg,
87  bool isCalleeStructRet,
88  bool isCallerStructRet,
89  const
91  const SmallVectorImpl<SDValue> &OutVals,
93  SelectionDAG& DAG) const;
94 
95  virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const;
96  virtual bool isTruncateFree(EVT VT1, EVT VT2) const;
97 
98  virtual bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const;
99 
100  virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
101 
102  virtual const char *getTargetNodeName(unsigned Opcode) const;
103  SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
105  SDValue LowerINLINEASM(SDValue Op, SelectionDAG &DAG) const;
106  SDValue LowerEH_LABEL(SDValue Op, SelectionDAG &DAG) const;
107  SDValue LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
109  CallingConv::ID CallConv, bool isVarArg,
111  SDLoc dl, SelectionDAG &DAG,
112  SmallVectorImpl<SDValue> &InVals) const;
115 
117  SmallVectorImpl<SDValue> &InVals) const;
118 
119  SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
120  CallingConv::ID CallConv, bool isVarArg,
122  SDLoc dl, SelectionDAG &DAG,
123  SmallVectorImpl<SDValue> &InVals,
124  const SmallVectorImpl<SDValue> &OutVals,
125  SDValue Callee) const;
126 
127  SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
128  SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
131 
133  CallingConv::ID CallConv, bool isVarArg,
135  const SmallVectorImpl<SDValue> &OutVals,
136  SDLoc dl, SelectionDAG &DAG) const;
137 
138  virtual MachineBasicBlock
140  MachineBasicBlock *BB) const;
141 
142  SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
144  virtual EVT getSetCCResultType(LLVMContext &C, EVT VT) const {
145  if (!VT.isVector())
146  return MVT::i1;
147  else
149  }
150 
151  virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op,
152  SDValue &Base, SDValue &Offset,
154  SelectionDAG &DAG) const;
155 
156  std::pair<unsigned, const TargetRegisterClass*>
157  getRegForInlineAsmConstraint(const std::string &Constraint,
158  MVT VT) const;
159 
160  // Intrinsics
162  SelectionDAG &DAG) const;
163  /// isLegalAddressingMode - Return true if the addressing mode represented
164  /// by AM is legal for this target, for a load/store of the specified type.
165  /// The type may be VoidTy, in which case only return true if the addressing
166  /// mode is legal for a load/store of any legal type.
167  /// TODO: Handle pre/postinc as well.
168  virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const;
169  virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
170 
171  /// isLegalICmpImmediate - Return true if the specified immediate is legal
172  /// icmp immediate, that is the target has icmp instructions which can
173  /// compare a register against the immediate without having to materialize
174  /// the immediate into a register.
175  virtual bool isLegalICmpImmediate(int64_t Imm) const;
176  };
177 } // end namespace llvm
178 
179 #endif // Hexagon_ISELLOWERING_H
virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const
virtual bool isLegalICmpImmediate(int64_t Imm) const
SDValue LowerCallResult(SDValue Chain, SDValue InFlag, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, SDLoc dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals, const SmallVectorImpl< SDValue > &OutVals, SDValue Callee) const
SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
bool isVector() const
isVector - Return true if this is a vector value type.
Definition: ValueTypes.h:661
virtual EVT getSetCCResultType(LLVMContext &C, EVT VT) const
virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const
virtual bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
HexagonTargetMachine & TM
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const
SDValue LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const
SDValue LowerINLINEASM(SDValue Op, SelectionDAG &DAG) const
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
Definition: APFloat.h:122
virtual const char * getTargetNodeName(unsigned Opcode) const
This method returns the name of a target specific DAG node.
virtual SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const
SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const
SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const
SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG) const
virtual bool isTruncateFree(Type *Ty1, Type *Ty2) const
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements)
Definition: ValueTypes.h:616
SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const
SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const
SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, SDLoc dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const
virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base, SDValue &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) const
AddrMode
ARM Addressing Modes.
Definition: ARMBaseInfo.h:234
virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *BB) const
bool IsEligibleForTailCallOptimization(SDValue Callee, CallingConv::ID CalleeCC, bool isVarArg, bool isCalleeStructRet, bool isCallerStructRet, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SmallVectorImpl< ISD::InputArg > &Ins, SelectionDAG &DAG) const
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const
SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const
#define N
SDValue LowerEH_LABEL(SDValue Op, SelectionDAG &DAG) const
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, SDLoc dl, SelectionDAG &DAG) const
HexagonTargetLowering(HexagonTargetMachine &targetmachine)
SDValue LowerGLOBALADDRESS(SDValue Op, SelectionDAG &DAG) const
unsigned getVectorNumElements() const
Definition: ValueTypes.h:771