PageRenderTime 46ms CodeModel.GetById 42ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/3rd_party/llvm/lib/Target/SystemZ/SystemZInstrBuilder.h

https://code.google.com/p/softart/
C Header | 48 lines | 28 code | 6 blank | 14 comment | 2 complexity | 0ce38fdb344b815d2b45e6e632c732f9 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, JSON, MPL-2.0-no-copyleft-exception, GPL-2.0, GPL-3.0, LGPL-3.0, BSD-2-Clause
 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 SYSTEMZINSTRBUILDER_H
16#define SYSTEMZINSTRBUILDER_H
17
18#include "llvm/CodeGen/MachineFrameInfo.h"
19#include "llvm/CodeGen/MachineInstrBuilder.h"
20#include "llvm/CodeGen/MachineMemOperand.h"
21#include "llvm/CodeGen/PseudoSourceValue.h"
22
23namespace llvm {
24
25/// Add a BDX memory reference for frame object FI to MIB.
26static inline const MachineInstrBuilder &
27addFrameReference(const MachineInstrBuilder &MIB, int FI) {
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())
34    Flags |= MachineMemOperand::MOLoad;
35  if (MCID.mayStore())
36    Flags |= MachineMemOperand::MOStore;
37  int64_t Offset = 0;
38  MachineMemOperand *MMO =
39    MF.getMachineMemOperand(MachinePointerInfo(
40                              PseudoSourceValue::getFixedStack(FI), Offset),
41                            Flags, MFFrame->getObjectSize(FI),
42                            MFFrame->getObjectAlignment(FI));
43  return MIB.addFrameIndex(FI).addImm(Offset).addReg(0).addMemOperand(MMO);
44}
45
46} // End llvm namespace
47
48#endif