blob: ea3171d0276e831b64a633585ad1a1b6900ef5b6 [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
18#include "llvm/Target/TargetLowering.h"
19#include "Sparc.h"
20
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.
38 RET_FLAG // Return with a flag operand.
39 };
40 }
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000041
Chris Lattnerd23405e2008-03-17 03:21:36 +000042 class SparcTargetLowering : public TargetLowering {
43 int VarArgsFrameOffset; // Frame offset to start of varargs area.
44 public:
45 SparcTargetLowering(TargetMachine &TM);
Dan Gohman475871a2008-07-27 21:46:04 +000046 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000047
Chris Lattnerd23405e2008-03-17 03:21:36 +000048 int getVarArgsFrameOffset() const { return VarArgsFrameOffset; }
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000049
50 /// computeMaskedBitsForTargetNode - Determine which of the bits specified
51 /// in Mask are known to be either zero or one and return them in the
Chris Lattnerd23405e2008-03-17 03:21:36 +000052 /// KnownZero/KnownOne bitsets.
Dan Gohman475871a2008-07-27 21:46:04 +000053 virtual void computeMaskedBitsForTargetNode(const SDValue Op,
Chris Lattnerd23405e2008-03-17 03:21:36 +000054 const APInt &Mask,
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000055 APInt &KnownZero,
Chris Lattnerd23405e2008-03-17 03:21:36 +000056 APInt &KnownOne,
57 const SelectionDAG &DAG,
58 unsigned Depth = 0) const;
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000059
Dan Gohmana44b6742008-06-30 20:31:15 +000060 virtual void LowerArguments(Function &F, SelectionDAG &DAG,
Dan Gohman475871a2008-07-27 21:46:04 +000061 SmallVectorImpl<SDValue> &ArgValues);
Chris Lattnerd23405e2008-03-17 03:21:36 +000062 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
63 MachineBasicBlock *MBB);
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000064
Chris Lattnerd23405e2008-03-17 03:21:36 +000065 virtual const char *getTargetNodeName(unsigned Opcode) const;
Anton Korobeynikov0eefda12008-10-10 20:28:10 +000066
67 ConstraintType getConstraintType(const std::string &Constraint) const;
68 std::pair<unsigned, const TargetRegisterClass*>
69 getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const;
70 std::vector<unsigned>
71 getRegClassForInlineAsmConstraint(const std::string &Constraint,
72 MVT VT) const;
Chris Lattnerd23405e2008-03-17 03:21:36 +000073 };
74} // end namespace llvm
75
76#endif // SPARC_ISELLOWERING_H