blob: c3c8179054bb5478c8ed47c43b2c4538596341e8 [file] [log] [blame]
Nikolai Bozhenov1cf9c542017-12-07 12:35:02 +00001//===-- Nios2ISelLowering.h - Nios2 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 Nios2 uses to lower LLVM code into a
11// selection DAG.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_NIOS2_NIOS2ISELLOWERING_H
16#define LLVM_LIB_TARGET_NIOS2_NIOS2ISELLOWERING_H
17
18#include "Nios2.h"
19#include "llvm/CodeGen/TargetLowering.h"
20
21namespace llvm {
22class Nios2Subtarget;
23
24namespace Nios2ISD {
25enum NodeType {
26 // Start the numbering from where ISD NodeType finishes.
27 FIRST_NUMBER = ISD::BUILTIN_OP_END,
28
29 // Get the Higher 16 bits from a 32-bit immediate
30 // No relation with Nios2 Hi register
31 Hi,
32 // Get the Lower 16 bits from a 32-bit immediate
33 // No relation with Nios2 Lo register
34 Lo,
35 // Return
36 Ret
37};
38}
39
40class Nios2TargetLowering : public TargetLowering {
41 const Nios2Subtarget *Subtarget;
42
43public:
44 Nios2TargetLowering(const TargetMachine &TM, const Nios2Subtarget &STI);
45
46 /// getTargetNodeName - This method returns the name of a target specific
47 // DAG node.
48 const char *getTargetNodeName(unsigned Opcode) const override;
49
50 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
51 bool IsVarArg,
52 const SmallVectorImpl<ISD::InputArg> &Ins,
53 const SDLoc &dl, SelectionDAG &DAG,
54 SmallVectorImpl<SDValue> &InVals) const override;
55
56 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
57 const SmallVectorImpl<ISD::OutputArg> &Outs,
58 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &dl,
59 SelectionDAG &DAG) const override;
60};
61} // end namespace llvm
62
63#endif // NIOS2_ISELLOWERING_H