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