[ARM] MVE integer min and max
[llvm-complete.git] / lib / Target / SystemZ / SystemZInstrBuilder.h
blobec7639e71f81918204c34e902966da4ab2feebc3
1 //===-- SystemZInstrBuilder.h - Functions to aid building insts -*- 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 exposes functions that may be used with BuildMI from the
10 // MachineInstrBuilder.h file to handle SystemZ'isms in a clean way.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRBUILDER_H
15 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRBUILDER_H
17 #include "llvm/CodeGen/MachineFrameInfo.h"
18 #include "llvm/CodeGen/MachineInstrBuilder.h"
19 #include "llvm/CodeGen/MachineMemOperand.h"
20 #include "llvm/CodeGen/PseudoSourceValue.h"
22 namespace llvm {
24 /// Add a BDX memory reference for frame object FI to MIB.
25 static inline const MachineInstrBuilder &
26 addFrameReference(const MachineInstrBuilder &MIB, int FI) {
27 MachineInstr *MI = MIB;
28 MachineFunction &MF = *MI->getParent()->getParent();
29 MachineFrameInfo &MFFrame = MF.getFrameInfo();
30 const MCInstrDesc &MCID = MI->getDesc();
31 auto Flags = MachineMemOperand::MONone;
32 if (MCID.mayLoad())
33 Flags |= MachineMemOperand::MOLoad;
34 if (MCID.mayStore())
35 Flags |= MachineMemOperand::MOStore;
36 int64_t Offset = 0;
37 MachineMemOperand *MMO = MF.getMachineMemOperand(
38 MachinePointerInfo::getFixedStack(MF, FI, Offset), Flags,
39 MFFrame.getObjectSize(FI), MFFrame.getObjectAlignment(FI));
40 return MIB.addFrameIndex(FI).addImm(Offset).addReg(0).addMemOperand(MMO);
43 } // end namespace llvm
45 #endif