1 //==-- SPUInstrBuilder.h - Aides for building Cell SPU insts -----*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 //===----------------------------------------------------------------------===//
7 // This file exposes functions that may be used with BuildMI from the
8 // MachineInstrBuilder.h file to simplify generating frame and constant pool
11 // For reference, the order of operands for memory references is:
12 // (Operand), Dest Reg, Base Reg, and either Reg Index or Immediate
15 //===----------------------------------------------------------------------===//
17 #ifndef SPU_INSTRBUILDER_H
18 #define SPU_INSTRBUILDER_H
20 #include "llvm/CodeGen/MachineInstrBuilder.h"
24 /// addFrameReference - This function is used to add a reference to the base of
25 /// an abstract object on the stack frame of the current function. This
26 /// reference has base register as the FrameIndex offset until it is resolved.
27 /// This allows a constant offset to be specified as well...
29 inline const MachineInstrBuilder&
30 addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0,
33 return MIB.addImm(Offset).addFrameIndex(FI);
35 return MIB.addFrameIndex(FI).addImm(Offset);
38 /// addConstantPoolReference - This function is used to add a reference to the
39 /// base of a constant value spilled to the per-function constant pool. The
40 /// reference has base register ConstantPoolIndex offset which is retained until
41 /// either machine code emission or assembly output. This allows an optional
42 /// offset to be added as well.
44 inline const MachineInstrBuilder&
45 addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
47 return MIB.addImm(Offset).addConstantPoolIndex(CPI);
50 } // End llvm namespace