LLVM 22.0.0git
LanaiISelLowering.h
Go to the documentation of this file.
1//===-- LanaiISelLowering.h - Lanai DAG Lowering Interface -....-*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the interfaces that Lanai uses to lower LLVM code into a
10// selection DAG.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_LANAI_LANAIISELLOWERING_H
15#define LLVM_LIB_TARGET_LANAI_LANAIISELLOWERING_H
16
17#include "Lanai.h"
18#include "LanaiRegisterInfo.h"
21
22namespace llvm {
23
24class LanaiSubtarget;
25
27public:
29
30 // LowerOperation - Provide custom lowering hooks for some operations.
31 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
32
47
49 bool IsVarArg,
51 LLVMContext &Context, const Type *RetTy) const override;
52
53 Register getRegisterByName(const char *RegName, LLT VT,
54 const MachineFunction &MF) const override;
55 std::pair<unsigned, const TargetRegisterClass *>
57 StringRef Constraint, MVT VT) const override;
60 const char *Constraint) const override;
62 std::vector<SDValue> &Ops,
63 SelectionDAG &DAG) const override;
64
65 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
66
68 const APInt &DemandedElts,
69 const SelectionDAG &DAG,
70 unsigned Depth = 0) const override;
71
72private:
73 SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee,
74 CallingConv::ID CallConv, bool IsVarArg,
75 bool IsTailCall,
77 const SmallVectorImpl<SDValue> &OutVals,
79 const SDLoc &dl, SelectionDAG &DAG,
80 SmallVectorImpl<SDValue> &InVals) const;
81
82 SDValue LowerCCCArguments(SDValue Chain, CallingConv::ID CallConv,
83 bool IsVarArg,
85 const SDLoc &DL, SelectionDAG &DAG,
86 SmallVectorImpl<SDValue> &InVals) const;
87
88 SDValue LowerCallResult(SDValue Chain, SDValue InGlue,
89 CallingConv::ID CallConv, bool IsVarArg,
91 const SDLoc &DL, SelectionDAG &DAG,
92 SmallVectorImpl<SDValue> &InVals) const;
93
95 SmallVectorImpl<SDValue> &InVals) const override;
96
97 SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
98 bool IsVarArg,
100 const SDLoc &DL, SelectionDAG &DAG,
101 SmallVectorImpl<SDValue> &InVals) const override;
102
103 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
105 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
106 SelectionDAG &DAG) const override;
107
108 const LanaiRegisterInfo *TRI;
109};
110} // namespace llvm
111
112#endif // LLVM_LIB_TARGET_LANAI_LANAIISELLOWERING_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Analysis containing CSE Info
Definition CSEInfo.cpp:27
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define RegName(no)
This file describes how to lower LLVM code to machine code.
Class for arbitrary precision integers.
Definition APInt.h:78
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const
SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const
SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const
SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const
SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG) const
SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const
LanaiTargetLowering(const TargetMachine &TM, const LanaiSubtarget &STI)
SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const
SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const
SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context, const Type *RetTy) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &Info, const char *Constraint) const override
Examine constraint string and operand type and determine a weight value.
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
Lower the specified operand into the Ops vector.
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
Machine Value Type.
Wrapper class representing virtual and physical registers.
Definition Register.h:19
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
TargetLowering(const TargetLowering &)=delete
Primary interface to the complete machine description for the target machine.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
DWARFExpression::Operation Op
#define N
This contains information for each constraint that we are lowering.
This structure contains all information that is necessary for lowering calls.