LLVM  3.7.0
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  unsigned Flags = 0;
33  if (MCID.mayLoad())
35  if (MCID.mayStore())
37  int64_t Offset = 0;
38  MachineMemOperand *MMO =
41  Flags, MFFrame->getObjectSize(FI),
42  MFFrame->getObjectAlignment(FI));
43  return MIB.addFrameIndex(FI).addImm(Offset).addReg(0).addMemOperand(MMO);
44 }
45 
46 } // end namespace llvm
47 
48 #endif
The memory access reads data.
const MachineFunction * getParent() const
getParent - Return the MachineFunction containing this basic block.
The memory access writes data.
bool mayStore() const
Return true if this instruction could possibly modify memory.
Definition: MCInstrDesc.h:356
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:138
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Definition: MachineInstr.h:264
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, unsigned f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineMemOperand - A description of a memory reference used in the backend.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
static const PseudoSourceValue * getFixedStack(int FI)
A pseudo source value referencing a fixed stack frame entry, e.g., a spill slot.
const MachineInstrBuilder & addImm(int64_t Val) const
addImm - Add a new immediate operand.
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:120
MachinePointerInfo - This class contains a discriminated union of information about pointers in memor...
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...
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
bool mayLoad() const
Return true if this instruction could possibly read memory.
Definition: MCInstrDesc.h:350
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MachineInstrBuilder & addFrameIndex(int Idx) const
Representation of each machine instruction.
Definition: MachineInstr.h:51
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
addReg - Add a new virtual register operand...
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.