1 //==-- SPUInstrBuilder.h - Aides for building Cell SPU insts -----*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by a team from the Computer Systems Research
6 // Department at The Aerospace Corporation and is distributed under the
7 // University of Illinois Open Source License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 // This file exposes functions that may be used with BuildMI from the
12 // MachineInstrBuilder.h file to simplify generating frame and constant pool
15 // For reference, the order of operands for memory references is:
16 // (Operand), Dest Reg, Base Reg, and either Reg Index or Immediate
19 //===----------------------------------------------------------------------===//
21 #ifndef SPU_INSTRBUILDER_H
22 #define SPU_INSTRBUILDER_H
24 #include "llvm/CodeGen/MachineInstrBuilder.h"
28 /// addFrameReference - This function is used to add a reference to the base of
29 /// an abstract object on the stack frame of the current function. This
30 /// reference has base register as the FrameIndex offset until it is resolved.
31 /// This allows a constant offset to be specified as well...
33 inline const MachineInstrBuilder&
34 addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
37 return MIB.addImm(Offset).addFrameIndex(FI);
39 return MIB.addFrameIndex(FI).addImm(Offset);
42 /// addConstantPoolReference - This function is used to add a reference to the
43 /// base of a constant value spilled to the per-function constant pool. The
44 /// reference has base register ConstantPoolIndex offset which is retained until
45 /// either machine code emission or assembly output. This allows an optional
46 /// offset to be added as well.
48 inline const MachineInstrBuilder&
49 addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
51 return MIB.addImm(Offset).addConstantPoolIndex(CPI);
54 } // End llvm namespace