Path: blob/main/contrib/llvm-project/llvm/lib/Target/Lanai/LanaiISelLowering.h
35271 views
//===-- LanaiISelLowering.h - Lanai DAG Lowering Interface -....-*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file defines the interfaces that Lanai uses to lower LLVM code into a9// selection DAG.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_LANAI_LANAIISELLOWERING_H14#define LLVM_LIB_TARGET_LANAI_LANAIISELLOWERING_H1516#include "Lanai.h"17#include "LanaiRegisterInfo.h"18#include "llvm/CodeGen/SelectionDAG.h"19#include "llvm/CodeGen/TargetLowering.h"2021namespace llvm {22namespace LanaiISD {23enum {24FIRST_NUMBER = ISD::BUILTIN_OP_END,2526ADJDYNALLOC,2728// Return with a glue operand. Operand 0 is the chain operand.29RET_GLUE,3031// CALL - These operations represent an abstract call instruction, which32// includes a bunch of information.33CALL,3435// SELECT_CC - Operand 0 and operand 1 are selection variable, operand 336// is condition code and operand 4 is flag operand.37SELECT_CC,3839// SETCC - Store the conditional code to a register.40SETCC,4142// SET_FLAG - Set flag compare.43SET_FLAG,4445// SUBBF - Subtract with borrow that sets flags.46SUBBF,4748// BR_CC - Used to glue together a conditional branch and comparison49BR_CC,5051// Wrapper - A wrapper node for TargetConstantPool, TargetExternalSymbol,52// and TargetGlobalAddress.53Wrapper,5455// Get the Higher/Lower 16 bits from a 32-bit immediate.56HI,57LO,5859// Small 21-bit immediate in global memory.60SMALL61};62} // namespace LanaiISD6364class LanaiSubtarget;6566class LanaiTargetLowering : public TargetLowering {67public:68LanaiTargetLowering(const TargetMachine &TM, const LanaiSubtarget &STI);6970// LowerOperation - Provide custom lowering hooks for some operations.71SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;7273// getTargetNodeName - This method returns the name of a target specific74// DAG node.75const char *getTargetNodeName(unsigned Opcode) const override;7677SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;78SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;79SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;80SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;81SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;82SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;83SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;84SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const;85SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;86SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;87SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;88SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG) const;89SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const;90SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;9192bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,93bool IsVarArg,94const SmallVectorImpl<ISD::OutputArg> &Outs,95LLVMContext &Context) const override;9697Register getRegisterByName(const char *RegName, LLT VT,98const MachineFunction &MF) const override;99std::pair<unsigned, const TargetRegisterClass *>100getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,101StringRef Constraint, MVT VT) const override;102ConstraintWeight103getSingleConstraintMatchWeight(AsmOperandInfo &Info,104const char *Constraint) const override;105void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint,106std::vector<SDValue> &Ops,107SelectionDAG &DAG) const override;108109SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;110111void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known,112const APInt &DemandedElts,113const SelectionDAG &DAG,114unsigned Depth = 0) const override;115116private:117SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee,118CallingConv::ID CallConv, bool IsVarArg,119bool IsTailCall,120const SmallVectorImpl<ISD::OutputArg> &Outs,121const SmallVectorImpl<SDValue> &OutVals,122const SmallVectorImpl<ISD::InputArg> &Ins,123const SDLoc &dl, SelectionDAG &DAG,124SmallVectorImpl<SDValue> &InVals) const;125126SDValue LowerCCCArguments(SDValue Chain, CallingConv::ID CallConv,127bool IsVarArg,128const SmallVectorImpl<ISD::InputArg> &Ins,129const SDLoc &DL, SelectionDAG &DAG,130SmallVectorImpl<SDValue> &InVals) const;131132SDValue LowerCallResult(SDValue Chain, SDValue InGlue,133CallingConv::ID CallConv, bool IsVarArg,134const SmallVectorImpl<ISD::InputArg> &Ins,135const SDLoc &DL, SelectionDAG &DAG,136SmallVectorImpl<SDValue> &InVals) const;137138SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI,139SmallVectorImpl<SDValue> &InVals) const override;140141SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,142bool IsVarArg,143const SmallVectorImpl<ISD::InputArg> &Ins,144const SDLoc &DL, SelectionDAG &DAG,145SmallVectorImpl<SDValue> &InVals) const override;146147SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,148const SmallVectorImpl<ISD::OutputArg> &Outs,149const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,150SelectionDAG &DAG) const override;151152const LanaiRegisterInfo *TRI;153};154} // namespace llvm155156#endif // LLVM_LIB_TARGET_LANAI_LANAIISELLOWERING_H157158159