LLVM API Documentation
00001 //===-- PPCInstrBuilder.h - Aides for building PPC insts --------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file exposes functions that may be used with BuildMI from the 00011 // MachineInstrBuilder.h file to simplify generating frame and constant pool 00012 // references. 00013 // 00014 // For reference, the order of operands for memory references is: 00015 // (Operand), Dest Reg, Base Reg, and either Reg Index or Immediate 00016 // Displacement. 00017 // 00018 //===----------------------------------------------------------------------===// 00019 00020 #ifndef LLVM_LIB_TARGET_POWERPC_PPCINSTRBUILDER_H 00021 #define LLVM_LIB_TARGET_POWERPC_PPCINSTRBUILDER_H 00022 00023 #include "llvm/CodeGen/MachineInstrBuilder.h" 00024 00025 namespace llvm { 00026 00027 /// addFrameReference - This function is used to add a reference to the base of 00028 /// an abstract object on the stack frame of the current function. This 00029 /// reference has base register as the FrameIndex offset until it is resolved. 00030 /// This allows a constant offset to be specified as well... 00031 /// 00032 static inline const MachineInstrBuilder& 00033 addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0, 00034 bool mem = true) { 00035 if (mem) 00036 return MIB.addImm(Offset).addFrameIndex(FI); 00037 else 00038 return MIB.addFrameIndex(FI).addImm(Offset); 00039 } 00040 00041 } // End llvm namespace 00042 00043 #endif