1 //===-- PowerPCInstrBuilder.h - Functions to aid building PPC insts -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file exposes functions that may be used with BuildMI from the
11 // MachineInstrBuilder.h file to simplify generating frame and constant pool
14 // For reference, the order of operands for memory references is:
15 // (Operand), Dest Reg, Base Reg, and either Reg Index or Immediate Displacement.
17 //===----------------------------------------------------------------------===//
19 #ifndef PPCINSTRBUILDER_H
20 #define PPCINSTRBUILDER_H
22 #include "llvm/CodeGen/MachineInstrBuilder.h"
26 /// addFrameReference - This function is used to add a reference to the base of
27 /// an abstract object on the stack frame of the current function. This
28 /// reference has base register as the FrameIndex offset until it is resolved.
29 /// This allows a constant offset to be specified as well...
31 inline const MachineInstrBuilder &
32 addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0, bool mem = true) {
34 return MIB.addSImm(Offset).addFrameIndex(FI);
36 return MIB.addFrameIndex(FI).addSImm(Offset);
39 /// addConstantPoolReference - This function is used to add a reference to the
40 /// base of a constant value spilled to the per-function constant pool. The
41 /// reference has base register ConstantPoolIndex offset which is retained until
42 /// either machine code emission or assembly output. This allows an optional
43 /// offset to be added as well.
45 inline const MachineInstrBuilder &
46 addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
48 return MIB.addSImm(Offset).addConstantPoolIndex(CPI);
51 } // End llvm namespace