blob: e2b4b3f4a89c8c02ff207b9f081e973438e9a531 [file] [log] [blame]
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00001//===-- MipsISelLowering.h - Mips DAG Lowering Interface --------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the interfaces that Mips uses to lower LLVM code into a
11// selection DAG.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef MipsISELLOWERING_H
16#define MipsISELLOWERING_H
17
18#include "llvm/CodeGen/SelectionDAG.h"
19#include "llvm/Target/TargetLowering.h"
20#include "Mips.h"
21#include "MipsSubtarget.h"
22
23namespace llvm {
24 namespace MipsISD {
25 enum NodeType {
26 // Start the numbering from where ISD NodeType finishes.
27 FIRST_NUMBER = ISD::BUILTIN_OP_END+Mips::INSTRUCTION_LIST_END,
28
29 // Jump and link (call)
30 JmpLink,
31
32 // Get the Higher 16 bits from a 32-bit immediate
33 // No relation with Mips Hi register
34 Hi,
35
36 // Get the Lower 16 bits from a 32-bit immediate
37 // No relation with Mips Lo register
38 Lo,
39
40 // Return
Bruno Cardoso Lopesc7db5612007-11-05 03:02:32 +000041 Ret
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000042 };
43 }
44
45 //===--------------------------------------------------------------------===//
46 // TargetLowering Implementation
47 //===--------------------------------------------------------------------===//
48 class MipsTargetLowering : public TargetLowering
49 {
50 // FrameIndex for return slot.
51 int ReturnAddrIndex;
52
53 // const MipsSubtarget &MipsSubTarget;
54 public:
55
Dan Gohman61e729e2007-08-02 21:21:54 +000056 explicit MipsTargetLowering(MipsTargetMachine &TM);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000057
58 /// LowerOperation - Provide custom lowering hooks for some operations.
59 virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
60
61 /// getTargetNodeName - This method returns the name of a target specific
62 // DAG node.
63 virtual const char *getTargetNodeName(unsigned Opcode) const;
64
Scott Michel5b8f82e2008-03-10 15:42:14 +000065 /// getSetCCResultType - get the ISD::SETCC result ValueType
66 MVT::ValueType getSetCCResultType(const SDOperand &) const;
67
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000068 private:
69 // Lower Operand helpers
70 SDOperand LowerCCCArguments(SDOperand Op, SelectionDAG &DAG);
71 SDOperand LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC);
72 SDNode *LowerCallResult(SDOperand Chain, SDOperand InFlag, SDNode*TheCall,
73 unsigned CallingConv, SelectionDAG &DAG);
74 SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG);
75
76 // Lower Operand specifics
77 SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG);
78 SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG);
79 SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG);
80 SDOperand LowerGlobalAddress(SDOperand Op, SelectionDAG &DAG);
Lauro Ramos Venancio75ce0102007-07-11 17:19:51 +000081 SDOperand LowerGlobalTLSAddress(SDOperand Op, SelectionDAG &DAG);
Bruno Cardoso Lopes753a9872007-11-12 19:49:57 +000082 SDOperand LowerJumpTable(SDOperand Op, SelectionDAG &DAG);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000083
Bruno Cardoso Lopes84f47c52007-08-21 16:09:25 +000084 // Inline asm support
85 ConstraintType getConstraintType(const std::string &Constraint) const;
86
87 std::pair<unsigned, const TargetRegisterClass*>
88 getRegForInlineAsmConstraint(const std::string &Constraint,
89 MVT::ValueType VT) const;
90
91 std::vector<unsigned>
92 getRegClassForInlineAsmConstraint(const std::string &Constraint,
93 MVT::ValueType VT) const;
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000094 };
95}
96
97#endif // MipsISELLOWERING_H