blob: 37fb29d2b72ddb32e3d177d590b571ec495034ae [file] [log] [blame]
Chris Lattner36d23442008-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 Gohman868636e2008-09-23 18:42:32 +000024 FIRST_NUMBER = ISD::BUILTIN_OP_END,
Chris Lattner36d23442008-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 Korobeynikov8f518202008-10-10 20:28:10 +000031
Chris Lattner36d23442008-03-17 03:21:36 +000032 Hi, Lo, // Hi/Lo operations, typically on a global address.
Anton Korobeynikov8f518202008-10-10 20:28:10 +000033
Chris Lattner36d23442008-03-17 03:21:36 +000034 FTOI, // FP to Int within a FP register.
35 ITOF, // Int to FP within a FP register.
Anton Korobeynikov8f518202008-10-10 20:28:10 +000036
Chris Lattner36d23442008-03-17 03:21:36 +000037 CALL, // A call instruction.
38 RET_FLAG // Return with a flag operand.
39 };
40 }
Anton Korobeynikov8f518202008-10-10 20:28:10 +000041
Chris Lattner36d23442008-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 Gohman8181bd12008-07-27 21:46:04 +000046 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG);
Eli Friedman16c4bef2009-07-19 19:53:46 +000047 SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG);
Anton Korobeynikov8f518202008-10-10 20:28:10 +000048
Chris Lattner36d23442008-03-17 03:21:36 +000049 int getVarArgsFrameOffset() const { return VarArgsFrameOffset; }
Anton Korobeynikov8f518202008-10-10 20:28:10 +000050
51 /// computeMaskedBitsForTargetNode - Determine which of the bits specified
52 /// in Mask are known to be either zero or one and return them in the
Chris Lattner36d23442008-03-17 03:21:36 +000053 /// KnownZero/KnownOne bitsets.
Dan Gohman8181bd12008-07-27 21:46:04 +000054 virtual void computeMaskedBitsForTargetNode(const SDValue Op,
Chris Lattner36d23442008-03-17 03:21:36 +000055 const APInt &Mask,
Anton Korobeynikov8f518202008-10-10 20:28:10 +000056 APInt &KnownZero,
Chris Lattner36d23442008-03-17 03:21:36 +000057 APInt &KnownOne,
58 const SelectionDAG &DAG,
59 unsigned Depth = 0) const;
Anton Korobeynikov8f518202008-10-10 20:28:10 +000060
Chris Lattner36d23442008-03-17 03:21:36 +000061 virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI,
Dan Gohman96d60922009-02-07 16:15:20 +000062 MachineBasicBlock *MBB) const;
Anton Korobeynikov8f518202008-10-10 20:28:10 +000063
Chris Lattner36d23442008-03-17 03:21:36 +000064 virtual const char *getTargetNodeName(unsigned Opcode) const;
Anton Korobeynikov8f518202008-10-10 20:28:10 +000065
66 ConstraintType getConstraintType(const std::string &Constraint) const;
67 std::pair<unsigned, const TargetRegisterClass*>
68 getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const;
69 std::vector<unsigned>
70 getRegClassForInlineAsmConstraint(const std::string &Constraint,
71 MVT VT) const;
Dan Gohman36322c72008-10-18 02:06:02 +000072
73 virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
Bill Wendling25a8ae32009-06-30 22:38:32 +000074
Bill Wendling045f2632009-07-01 18:50:55 +000075 /// getFunctionAlignment - Return the Log2 alignment of this function.
Bill Wendling25a8ae32009-06-30 22:38:32 +000076 virtual unsigned getFunctionAlignment(const Function *F) const;
Chris Lattner36d23442008-03-17 03:21:36 +000077 };
78} // end namespace llvm
79
80#endif // SPARC_ISELLOWERING_H