Path: blob/main/contrib/llvm-project/llvm/lib/Target/ARC/ARCISelLowering.h
35269 views
//===- ARCISelLowering.h - ARC 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 ARC uses to lower LLVM code into a9// selection DAG.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_ARC_ARCISELLOWERING_H14#define LLVM_LIB_TARGET_ARC_ARCISELLOWERING_H1516#include "ARC.h"17#include "llvm/CodeGen/SelectionDAG.h"18#include "llvm/CodeGen/TargetLowering.h"1920namespace llvm {2122// Forward delcarations23class ARCSubtarget;24class ARCTargetMachine;2526namespace ARCISD {2728enum NodeType : unsigned {29// Start the numbering where the builtin ops and target ops leave off.30FIRST_NUMBER = ISD::BUILTIN_OP_END,3132// Branch and link (call)33BL,3435// Jump and link (indirect call)36JL,3738// CMP39CMP,4041// CMOV42CMOV,4344// BRcc45BRcc,4647// Global Address Wrapper48GAWRAPPER,4950// return, (j_s [blink])51RET52};5354} // end namespace ARCISD5556//===--------------------------------------------------------------------===//57// TargetLowering Implementation58//===--------------------------------------------------------------------===//59class ARCTargetLowering : public TargetLowering {60public:61explicit ARCTargetLowering(const TargetMachine &TM,62const ARCSubtarget &Subtarget);6364/// Provide custom lowering hooks for some operations.65SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;6667/// This method returns the name of a target specific DAG node.68const char *getTargetNodeName(unsigned Opcode) const override;6970/// Return true if the addressing mode represented by AM is legal for this71/// target, for a load/store of the specified type.72bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,73unsigned AS,74Instruction *I = nullptr) const override;7576private:77const ARCSubtarget &Subtarget;7879void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue> &Results,80SelectionDAG &DAG) const override;8182// Lower Operand helpers83SDValue LowerCallArguments(SDValue Chain, CallingConv::ID CallConv,84bool isVarArg,85const SmallVectorImpl<ISD::InputArg> &Ins,86SDLoc dl, SelectionDAG &DAG,87SmallVectorImpl<SDValue> &InVals) const;88// Lower Operand specifics89SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;90SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;91SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;92SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;93SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const;94SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;95SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;9697SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,98bool isVarArg,99const SmallVectorImpl<ISD::InputArg> &Ins,100const SDLoc &dl, SelectionDAG &DAG,101SmallVectorImpl<SDValue> &InVals) const override;102103SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI,104SmallVectorImpl<SDValue> &InVals) const override;105106SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,107const SmallVectorImpl<ISD::OutputArg> &Outs,108const SmallVectorImpl<SDValue> &OutVals, const SDLoc &dl,109SelectionDAG &DAG) const override;110111bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,112bool isVarArg,113const SmallVectorImpl<ISD::OutputArg> &ArgsFlags,114LLVMContext &Context) const override;115116bool mayBeEmittedAsTailCall(const CallInst *CI) const override;117};118119} // end namespace llvm120121#endif // LLVM_LIB_TARGET_ARC_ARCISELLOWERING_H122123124