LLVM  4.0.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();
33  if (MCID.mayLoad())
35  if (MCID.mayStore())
37  int64_t Offset = 0;
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
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
bool mayStore() const
Return true if this instruction could possibly modify memory.
Definition: MCInstrDesc.h:384
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:163
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Definition: MachineInstr.h:270
A description of a memory reference used in the backend.
struct fuzzer::@269 Flags
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineBasicBlock * getParent() const
Definition: MachineInstr.h:131
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
uint32_t Offset
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.
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:378
const MachineInstrBuilder & addFrameIndex(int Idx) const
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SynchronizationScope SynchScope=CrossThread, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
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:52
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
IRTranslator LLVM IR MI
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.