LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SparcISelLowering.h
Go to the documentation of this file.
1 //===-- SparcISelLowering.h - Sparc 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 Sparc uses to lower LLVM code into a
11 // selection DAG.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef SPARC_ISELLOWERING_H
16 #define SPARC_ISELLOWERING_H
17 
18 #include "Sparc.h"
20 
21 namespace llvm {
22  class SparcSubtarget;
23 
24  namespace SPISD {
25  enum {
27  CMPICC, // Compare two GPR operands, set icc+xcc.
28  CMPFCC, // Compare two FP operands, set fcc.
29  BRICC, // Branch to dest on icc condition
30  BRXCC, // Branch to dest on xcc condition (64-bit only).
31  BRFCC, // Branch to dest on fcc condition
32  SELECT_ICC, // Select between two values using the current ICC flags.
33  SELECT_XCC, // Select between two values using the current XCC flags.
34  SELECT_FCC, // Select between two values using the current FCC flags.
35 
36  Hi, Lo, // Hi/Lo operations, typically on a global address.
37 
38  FTOI, // FP to Int within a FP register.
39  ITOF, // Int to FP within a FP register.
40  FTOX, // FP to Int64 within a FP register.
41  XTOF, // Int64 to FP within a FP register.
42 
43  CALL, // A call instruction.
44  RET_FLAG, // Return with a flag operand.
45  GLOBAL_BASE_REG, // Global base reg for PIC.
46  FLUSHW, // FLUSH register windows to stack.
47 
48  TLS_ADD, // For Thread Local Storage (TLS).
51  };
52  }
53 
55  const SparcSubtarget *Subtarget;
56  public:
58  virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
59 
60  /// computeMaskedBitsForTargetNode - Determine which of the bits specified
61  /// in Mask are known to be either zero or one and return them in the
62  /// KnownZero/KnownOne bitsets.
63  virtual void computeMaskedBitsForTargetNode(const SDValue Op,
64  APInt &KnownZero,
65  APInt &KnownOne,
66  const SelectionDAG &DAG,
67  unsigned Depth = 0) const;
68 
69  virtual MachineBasicBlock *
71  MachineBasicBlock *MBB) const;
72 
73  virtual const char *getTargetNodeName(unsigned Opcode) const;
74 
75  ConstraintType getConstraintType(const std::string &Constraint) const;
76  std::pair<unsigned, const TargetRegisterClass*>
77  getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const;
78 
79  virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
80  virtual MVT getScalarShiftAmountTy(EVT LHSTy) const { return MVT::i32; }
81 
82  virtual SDValue
84  CallingConv::ID CallConv,
85  bool isVarArg,
87  SDLoc dl, SelectionDAG &DAG,
88  SmallVectorImpl<SDValue> &InVals) const;
90  CallingConv::ID CallConv,
91  bool isVarArg,
93  SDLoc dl, SelectionDAG &DAG,
94  SmallVectorImpl<SDValue> &InVals) const;
96  CallingConv::ID CallConv,
97  bool isVarArg,
99  SDLoc dl, SelectionDAG &DAG,
100  SmallVectorImpl<SDValue> &InVals) const;
101 
102  virtual SDValue
104  SmallVectorImpl<SDValue> &InVals) const;
106  SmallVectorImpl<SDValue> &InVals) const;
108  SmallVectorImpl<SDValue> &InVals) const;
109 
110  virtual SDValue
111  LowerReturn(SDValue Chain,
112  CallingConv::ID CallConv, bool isVarArg,
114  const SmallVectorImpl<SDValue> &OutVals,
115  SDLoc dl, SelectionDAG &DAG) const;
117  CallingConv::ID CallConv, bool IsVarArg,
119  const SmallVectorImpl<SDValue> &OutVals,
120  SDLoc DL, SelectionDAG &DAG) const;
122  CallingConv::ID CallConv, bool IsVarArg,
124  const SmallVectorImpl<SDValue> &OutVals,
125  SDLoc DL, SelectionDAG &DAG) const;
126 
131 
132  unsigned getSRetArgSize(SelectionDAG &DAG, SDValue Callee) const;
133  SDValue withTargetFlags(SDValue Op, unsigned TF, SelectionDAG &DAG) const;
134  SDValue makeHiLoPair(SDValue Op, unsigned HiTF, unsigned LoTF,
135  SelectionDAG &DAG) const;
136  SDValue makeAddress(SDValue Op, SelectionDAG &DAG) const;
137 
139  SDValue Arg, SDLoc DL,
140  SelectionDAG &DAG) const;
142  const char *LibFuncName,
143  unsigned numArgs) const;
145  unsigned &SPCC,
146  SDLoc DL,
147  SelectionDAG &DAG) const;
148 
149  bool ShouldShrinkFPConstant(EVT VT) const {
150  // Do not shrink FP constpool if VT == MVT::f128.
151  // (ldd, call _Q_fdtoq) is more expensive than two ldds.
152  return VT != MVT::f128;
153  }
154 
155  virtual void ReplaceNodeResults(SDNode *N,
156  SmallVectorImpl<SDValue>& Results,
157  SelectionDAG &DAG) const;
158  };
159 } // end namespace llvm
160 
161 #endif // SPARC_ISELLOWERING_H
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const
unsigned getSRetArgSize(SelectionDAG &DAG, SDValue Callee) const
SDValue makeHiLoPair(SDValue Op, unsigned HiTF, unsigned LoTF, SelectionDAG &DAG) const
SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
SDValue LowerCall_32(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const
ConstraintType getConstraintType(const std::string &Constraint) const
virtual void computeMaskedBitsForTargetNode(const SDValue Op, APInt &KnownZero, APInt &KnownOne, const SelectionDAG &DAG, unsigned Depth=0) const
SDValue LowerCall_64(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const
SDValue LowerF128_LibCallArg(SDValue Chain, ArgListTy &Args, SDValue Arg, SDLoc DL, SelectionDAG &DAG) const
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
virtual SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, SDLoc dl, SelectionDAG &DAG) const
SparcTargetLowering(TargetMachine &TM)
SDValue withTargetFlags(SDValue Op, unsigned TF, SelectionDAG &DAG) const
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const
virtual MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const
SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
virtual SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, SDLoc dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const
SDValue LowerFormalArguments_64(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, SDLoc dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const
std::vector< ArgListEntry > ArgListTy
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFormalArguments_32(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, SDLoc dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const
virtual MVT getScalarShiftAmountTy(EVT LHSTy) const
SDValue makeAddress(SDValue Op, SelectionDAG &DAG) const
Class for arbitrary precision integers.
Definition: APInt.h:75
virtual const char * getTargetNodeName(unsigned Opcode) const
This method returns the name of a target specific DAG node.
virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const
SDValue LowerReturn_64(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, SDLoc DL, SelectionDAG &DAG) const
#define N
virtual void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const
SDValue LowerReturn_32(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, SDLoc DL, SelectionDAG &DAG) const
SDValue LowerF128Compare(SDValue LHS, SDValue RHS, unsigned &SPCC, SDLoc DL, SelectionDAG &DAG) const
bool ShouldShrinkFPConstant(EVT VT) const
SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const
SDValue LowerF128Op(SDValue Op, SelectionDAG &DAG, const char *LibFuncName, unsigned numArgs) const
virtual SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const