Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
MSP430ISelLowering.h
Go to the documentation of this file.
1//===-- MSP430ISelLowering.h - MSP430 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 MSP430 uses to lower LLVM code into a
10// selection DAG.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_MSP430_MSP430ISELLOWERING_H
15#define LLVM_LIB_TARGET_MSP430_MSP430ISELLOWERING_H
16
17#include "MSP430.h"
20
21namespace llvm {
22 class MSP430Subtarget;
24 public:
25 explicit MSP430TargetLowering(const TargetMachine &TM,
26 const MSP430Subtarget &STI);
27
28 MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override {
29 return MVT::i8;
30 }
31
33 return MVT::i16;
34 }
35
36 /// LowerOperation - Provide custom lowering hooks for some operations.
37 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
38
52
54 getConstraintType(StringRef Constraint) const override;
55 std::pair<unsigned, const TargetRegisterClass *>
57 StringRef Constraint, MVT VT) const override;
58
59 /// isTruncateFree - Return true if it's free to truncate a value of type
60 /// Ty1 to type Ty2. e.g. On msp430 it's free to truncate a i16 value in
61 /// register R15W to i8 by referencing its sub-register R15B.
62 bool isTruncateFree(Type *Ty1, Type *Ty2) const override;
63 bool isTruncateFree(EVT VT1, EVT VT2) const override;
64
65 /// isZExtFree - Return true if any actual instruction that defines a value
66 /// of type Ty1 implicit zero-extends the value to Ty2 in the result
67 /// register. This does not necessarily include registers defined in unknown
68 /// ways, such as incoming arguments, or copies from unknown virtual
69 /// registers. Also, if isTruncateFree(Ty2, Ty1) is true, this does not
70 /// necessarily apply to truncate instructions. e.g. on msp430, all
71 /// instructions that define 8-bit values implicit zero-extend the result
72 /// out to 16 bits.
73 bool isZExtFree(Type *Ty1, Type *Ty2) const override;
74 bool isZExtFree(EVT VT1, EVT VT2) const override;
75
76 bool isLegalICmpImmediate(int64_t) const override;
77 bool shouldAvoidTransformToShift(EVT VT, unsigned Amount) const override;
78
81 MachineBasicBlock *BB) const override;
83 MachineBasicBlock *BB) const;
84
85 private:
86 SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee,
87 CallingConv::ID CallConv, bool isVarArg,
88 bool isTailCall,
90 const SmallVectorImpl<SDValue> &OutVals,
92 const SDLoc &dl, SelectionDAG &DAG,
93 SmallVectorImpl<SDValue> &InVals) const;
94
95 SDValue LowerCCCArguments(SDValue Chain, CallingConv::ID CallConv,
96 bool isVarArg,
98 const SDLoc &dl, SelectionDAG &DAG,
99 SmallVectorImpl<SDValue> &InVals) const;
100
102 CallingConv::ID CallConv, bool isVarArg,
104 const SDLoc &dl, SelectionDAG &DAG,
105 SmallVectorImpl<SDValue> &InVals) const;
106
107 SDValue
108 LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
110 const SDLoc &dl, SelectionDAG &DAG,
111 SmallVectorImpl<SDValue> &InVals) const override;
112 SDValue
114 SmallVectorImpl<SDValue> &InVals) const override;
115
116 bool CanLowerReturn(CallingConv::ID CallConv,
117 MachineFunction &MF,
118 bool IsVarArg,
120 LLVMContext &Context, const Type *RetTy) const override;
121
122 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
124 const SmallVectorImpl<SDValue> &OutVals,
125 const SDLoc &dl, SelectionDAG &DAG) const override;
126
127 bool getPostIndexedAddressParts(SDNode *N, SDNode *Op,
128 SDValue &Base,
131 SelectionDAG &DAG) const override;
132 };
133} // namespace llvm
134
135#endif
IRTranslator LLVM IR MI
Register const TargetRegisterInfo * TRI
This file describes how to lower LLVM code to machine code.
static SDValue LowerCallResult(SDValue Chain, SDValue InGlue, const SmallVectorImpl< CCValAssign > &RVLocs, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals)
LowerCallResult - Lower the result values of a call into the appropriate copies out of appropriate ph...
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:63
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
SDValue getReturnAddressFrameIndex(SelectionDAG &DAG) const
MSP430TargetLowering(const TargetMachine &TM, const MSP430Subtarget &STI)
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
LowerOperation - Provide custom lowering hooks for some operations.
MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
Return the type to use for a scalar shift opcode, given the shifted amount type.
MVT::SimpleValueType getCmpLibcallReturnType() const override
Return the ValueType for comparison libcalls.
MachineBasicBlock * EmitShiftInstr(MachineInstr &MI, MachineBasicBlock *BB) const
SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const
SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const
SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) const
bool isTruncateFree(Type *Ty1, Type *Ty2) const override
isTruncateFree - Return true if it's free to truncate a value of type Ty1 to type Ty2.
SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const
SDValue LowerShifts(SDValue Op, SelectionDAG &DAG) const
SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const
SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG) const
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *BB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const
SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const
SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const
SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const
bool shouldAvoidTransformToShift(EVT VT, unsigned Amount) const override
Return true if creating a shift of the type by the given amount is not profitable.
bool isZExtFree(Type *Ty1, Type *Ty2) const override
isZExtFree - Return true if any actual instruction that defines a value of type Ty1 implicit zero-ext...
TargetLowering::ConstraintType getConstraintType(StringRef Constraint) const override
getConstraintType - Given a constraint letter, return the type of constraint it is for this target.
bool isLegalICmpImmediate(int64_t) const override
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
Machine Value Type.
Representation of each machine instruction.
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
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:477
DWARFExpression::Operation Op
#define N
Extended Value Type.
Definition ValueTypes.h:35
This structure contains all information that is necessary for lowering calls.