blob: ca11af2516bfe9f04e901d1e187b7dba340a7b4a [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//
5// This file was developed by Bruno Cardoso Lopes and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
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 Lopesde6a9412007-08-18 01:54:09 +000041 Ret,
42
43 Add
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000044 };
45 }
46
47 //===--------------------------------------------------------------------===//
48 // TargetLowering Implementation
49 //===--------------------------------------------------------------------===//
50 class MipsTargetLowering : public TargetLowering
51 {
52 // FrameIndex for return slot.
53 int ReturnAddrIndex;
54
55 // const MipsSubtarget &MipsSubTarget;
56 public:
57
Dan Gohman61e729e2007-08-02 21:21:54 +000058 explicit MipsTargetLowering(MipsTargetMachine &TM);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000059
60 /// LowerOperation - Provide custom lowering hooks for some operations.
61 virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG);
62
63 /// getTargetNodeName - This method returns the name of a target specific
64 // DAG node.
65 virtual const char *getTargetNodeName(unsigned Opcode) const;
66
67 private:
68 // Lower Operand helpers
69 SDOperand LowerCCCArguments(SDOperand Op, SelectionDAG &DAG);
70 SDOperand LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC);
71 SDNode *LowerCallResult(SDOperand Chain, SDOperand InFlag, SDNode*TheCall,
72 unsigned CallingConv, SelectionDAG &DAG);
73 SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG);
74
75 // Lower Operand specifics
76 SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG);
77 SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG);
78 SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG);
79 SDOperand LowerGlobalAddress(SDOperand Op, SelectionDAG &DAG);
Lauro Ramos Venancio75ce0102007-07-11 17:19:51 +000080 SDOperand LowerGlobalTLSAddress(SDOperand Op, SelectionDAG &DAG);
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +000081
82 };
83}
84
85#endif // MipsISELLOWERING_H