Path: blob/main/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZInstrBuilder.h
35269 views
//===-- SystemZInstrBuilder.h - Functions to aid building insts -*- 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 exposes functions that may be used with BuildMI from the9// MachineInstrBuilder.h file to handle SystemZ'isms in a clean way.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRBUILDER_H14#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRBUILDER_H1516#include "llvm/CodeGen/MachineFrameInfo.h"17#include "llvm/CodeGen/MachineInstrBuilder.h"18#include "llvm/CodeGen/MachineMemOperand.h"1920namespace llvm {2122/// Add a BDX memory reference for frame object FI to MIB.23static inline const MachineInstrBuilder &24addFrameReference(const MachineInstrBuilder &MIB, int FI) {25MachineInstr *MI = MIB;26MachineFunction &MF = *MI->getParent()->getParent();27MachineFrameInfo &MFFrame = MF.getFrameInfo();28const MCInstrDesc &MCID = MI->getDesc();29auto Flags = MachineMemOperand::MONone;30if (MCID.mayLoad())31Flags |= MachineMemOperand::MOLoad;32if (MCID.mayStore())33Flags |= MachineMemOperand::MOStore;34int64_t Offset = 0;35MachineMemOperand *MMO = MF.getMachineMemOperand(36MachinePointerInfo::getFixedStack(MF, FI, Offset), Flags,37MFFrame.getObjectSize(FI), MFFrame.getObjectAlign(FI));38return MIB.addFrameIndex(FI).addImm(Offset).addReg(0).addMemOperand(MMO);39}4041} // end namespace llvm4243#endif444546