blob: 09148ea5402775ea6b5451d12b818925d6e3c641 [file] [log] [blame]
Chris Lattnerd23405e2008-03-17 03:21:36 +00001//===-- 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
Chris Lattnerd23405e2008-03-17 03:21:36 +000018#include "Sparc.h"
Craig Topper79aa3412012-03-17 18:46:09 +000019#include "llvm/Target/TargetLowering.h"
Chris Lattnerd23405e2008-03-17 03:21:36 +000020
21namespace llvm {
22 namespace SPISD {
23 enum {
Dan Gohman0ba2bcf2008-09-23 18:42:32 +000024 FIRST_NUMBER = ISD::BUILTIN_OP_END,
Chris Lattnerd23405e2008-03-17 03:21:36 +000025 CMPICC, // Compare two GPR operands, set icc.
26 CMPFCC, // Compare two FP operands, set fcc.
27 BRICC, // Branch to dest on icc condition
28 BRFCC, // Branch to dest on fcc condition
29 SELECT_ICC, // Select between two values using the current ICC flags.
30 SELECT_FCC, // Select between two values using the current FCC flags.
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000031
Chris Lattnerd23405e2008-03-17 03:21:36 +000032 Hi, Lo, // Hi/Lo operations, typically on a global address.
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000033
Chris Lattnerd23405e2008-03-17 03:21:36 +000034 FTOI, // FP to Int within a FP register.
35 ITOF, // Int to FP within a FP register.
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000036
Chris Lattnerd23405e2008-03-17 03:21:36 +000037 CALL, // A call instruction.
Chris Lattnerdb486a62009-09-15 17:46:24 +000038 RET_FLAG, // Return with a flag operand.
Venkatraman Govindaraju860b64c2011-01-12 05:08:36 +000039 GLOBAL_BASE_REG, // Global base reg for PIC
Venkatraman Govindarajufc3faa72011-01-21 22:00:00 +000040 FLUSHW // FLUSH register windows to stack
Chris Lattnerd23405e2008-03-17 03:21:36 +000041 };
42 }
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000043
Chris Lattnerd23405e2008-03-17 03:21:36 +000044 class SparcTargetLowering : public TargetLowering {
Chris Lattnerd23405e2008-03-17 03:21:36 +000045 public:
46 SparcTargetLowering(TargetMachine &TM);
Dan Gohmand858e902010-04-17 15:26:15 +000047 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000048
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000049 /// computeMaskedBitsForTargetNode - Determine which of the bits specified
50 /// in Mask are known to be either zero or one and return them in the
Chris Lattnerd23405e2008-03-17 03:21:36 +000051 /// KnownZero/KnownOne bitsets.
Dan Gohman475871a2008-07-27 21:46:04 +000052 virtual void computeMaskedBitsForTargetNode(const SDValue Op,
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000053 APInt &KnownZero,
Chris Lattnerd23405e2008-03-17 03:21:36 +000054 APInt &KnownOne,
55 const SelectionDAG &DAG,
56 unsigned Depth = 0) const;
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000057
Dan Gohmanaf1d8ca2010-05-01 00:01:06 +000058 virtual MachineBasicBlock *
59 EmitInstrWithCustomInserter(MachineInstr *MI,
60 MachineBasicBlock *MBB) const;
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000061
Chris Lattnerd23405e2008-03-17 03:21:36 +000062 virtual const char *getTargetNodeName(unsigned Opcode) const;
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000063
64 ConstraintType getConstraintType(const std::string &Constraint) const;
65 std::pair<unsigned, const TargetRegisterClass*>
Owen Andersone50ed302009-08-10 22:56:29 +000066 getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const;
Dan Gohman6520e202008-10-18 02:06:02 +000067
68 virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
Bill Wendling20c568f2009-06-30 22:38:32 +000069
Dan Gohman98ca4f22009-08-05 01:29:28 +000070 virtual SDValue
71 LowerFormalArguments(SDValue Chain,
Sandeep Patel65c3c8f2009-09-02 08:44:58 +000072 CallingConv::ID CallConv,
Dan Gohman98ca4f22009-08-05 01:29:28 +000073 bool isVarArg,
74 const SmallVectorImpl<ISD::InputArg> &Ins,
75 DebugLoc dl, SelectionDAG &DAG,
Dan Gohmand858e902010-04-17 15:26:15 +000076 SmallVectorImpl<SDValue> &InVals) const;
Dan Gohman98ca4f22009-08-05 01:29:28 +000077
78 virtual SDValue
Justin Holewinskid2ea0e12012-05-25 16:35:28 +000079 LowerCall(TargetLowering::CallLoweringInfo &CLI,
Dan Gohmand858e902010-04-17 15:26:15 +000080 SmallVectorImpl<SDValue> &InVals) const;
Dan Gohman98ca4f22009-08-05 01:29:28 +000081
82 virtual SDValue
83 LowerReturn(SDValue Chain,
Sandeep Patel65c3c8f2009-09-02 08:44:58 +000084 CallingConv::ID CallConv, bool isVarArg,
Dan Gohman98ca4f22009-08-05 01:29:28 +000085 const SmallVectorImpl<ISD::OutputArg> &Outs,
Dan Gohmanc9403652010-07-07 15:54:55 +000086 const SmallVectorImpl<SDValue> &OutVals,
Dan Gohmand858e902010-04-17 15:26:15 +000087 DebugLoc dl, SelectionDAG &DAG) const;
Chris Lattnerdb486a62009-09-15 17:46:24 +000088
Dan Gohmand858e902010-04-17 15:26:15 +000089 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
90 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
Venkatraman Govindaraju58269b92011-02-21 03:42:44 +000091
92 unsigned getSRetArgSize(SelectionDAG &DAG, SDValue Callee) const;
Chris Lattnerd23405e2008-03-17 03:21:36 +000093 };
94} // end namespace llvm
95
96#endif // SPARC_ISELLOWERING_H