blob: 5e268f8767c2c75945fdb6c1d51d23ab58e3809c [file] [log] [blame]
Scott Michel266bc8f2007-12-04 22:23:35 +00001//==-- SPUInstrBuilder.h - Aides for building Cell SPU insts -----*- C++ -*-==//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Scott Michel2466c372007-12-05 01:40:25 +00007//
Scott Michel266bc8f2007-12-04 22:23:35 +00008//===----------------------------------------------------------------------===//
9//
10// This file exposes functions that may be used with BuildMI from the
11// MachineInstrBuilder.h file to simplify generating frame and constant pool
12// references.
13//
14// For reference, the order of operands for memory references is:
15// (Operand), Dest Reg, Base Reg, and either Reg Index or Immediate
16// Displacement.
17//
18//===----------------------------------------------------------------------===//
19
20#ifndef SPU_INSTRBUILDER_H
21#define SPU_INSTRBUILDER_H
22
23#include "llvm/CodeGen/MachineInstrBuilder.h"
24
25namespace llvm {
26
27/// addFrameReference - This function is used to add a reference to the base of
28/// an abstract object on the stack frame of the current function. This
29/// reference has base register as the FrameIndex offset until it is resolved.
30/// This allows a constant offset to be specified as well...
31///
32inline const MachineInstrBuilder&
33addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
34 bool mem = true) {
35 if (mem)
36 return MIB.addImm(Offset).addFrameIndex(FI);
37 else
38 return MIB.addFrameIndex(FI).addImm(Offset);
39}
40
Scott Michel266bc8f2007-12-04 22:23:35 +000041} // End llvm namespace
42
43#endif