LLVM  9.0.0svn
Go to the documentation of this file.
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.
11 //
12 //===----------------------------------------------------------------------===//
22 namespace llvm {
24 /// Add a BDX memory reference for frame object FI to MIB.
25 static inline const MachineInstrBuilder &
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())
34  if (MCID.mayStore())
36  int64_t Offset = 0;
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);
41 }
43 } // end namespace llvm
45 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:164
bool mayLoad() const
Return true if this instruction could possibly read memory.
Definition: MCInstrDesc.h:399
A description of a memory reference used in the backend.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Definition: MachineInstr.h:407
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MachineInstrBuilder & addFrameIndex(int Idx) const
static const MachineInstrBuilder & addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset=0, bool mem=true)
addFrameReference - This function is used to add a reference to the base of an abstract object on the...
The memory access writes data.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
bool mayStore() const
Return true if this instruction could possibly modify memory.
Definition: MCInstrDesc.h:405
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:255
The memory access reads data.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
Representation of each machine instruction.
Definition: MachineInstr.h:63
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
IRTranslator LLVM IR MI