LLVM  8.0.1
SystemZInstrBuilder.h
Go to the documentation of this file.
1 //===-- SystemZInstrBuilder.h - Functions to aid building insts -*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file exposes functions that may be used with BuildMI from the
11 // MachineInstrBuilder.h file to handle SystemZ'isms in a clean way.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRBUILDER_H
16 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZINSTRBUILDER_H
17 
22 
23 namespace llvm {
24 
25 /// Add a BDX memory reference for frame object FI to MIB.
26 static inline const MachineInstrBuilder &
28  MachineInstr *MI = MIB;
29  MachineFunction &MF = *MI->getParent()->getParent();
30  MachineFrameInfo &MFFrame = MF.getFrameInfo();
31  const MCInstrDesc &MCID = MI->getDesc();
32  auto Flags = MachineMemOperand::MONone;
33  if (MCID.mayLoad())
35  if (MCID.mayStore())
37  int64_t Offset = 0;
39  MachinePointerInfo::getFixedStack(MF, FI, Offset), Flags,
40  MFFrame.getObjectSize(FI), MFFrame.getObjectAlignment(FI));
41  return MIB.addFrameIndex(FI).addImm(Offset).addReg(0).addMemOperand(MMO);
42 }
43 
44 } // end namespace llvm
45 
46 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
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:406
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:254
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:64
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