New addFrameReference function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5182 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-12-28 20:26:58 +00:00
parent f2ab4124e3
commit a1826c2ecd

View File

@ -20,8 +20,9 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
/// addDirectMem - This function is used to add a direct memory reference to the
/// current instruction -- that is, a dereference of an address in a register, with
/// no scale, index or displacement. An example is: DWORD PTR [EAX].
/// current instruction -- that is, a dereference of an address in a register,
/// with no scale, index or displacement. An example is: DWORD PTR [EAX].
///
inline const MachineInstrBuilder &addDirectMem(const MachineInstrBuilder &MIB,
unsigned Reg) {
// Because memory references are always represented with four
@ -30,12 +31,23 @@ inline const MachineInstrBuilder &addDirectMem(const MachineInstrBuilder &MIB,
}
/// addRegOffset - This function is used to add a memory reference of
/// the form [Reg + Offset], i.e., one with no scale or index, but
/// with a displacement. An example is: DWORD PTR [EAX + 4].
/// addRegOffset - This function is used to add a memory reference of the form
/// [Reg + Offset], i.e., one with no scale or index, but with a
/// displacement. An example is: DWORD PTR [EAX + 4].
///
inline const MachineInstrBuilder &addRegOffset(const MachineInstrBuilder &MIB,
unsigned Reg, unsigned Offset) {
unsigned Reg, int Offset) {
return MIB.addReg(Reg).addZImm(1).addMReg(0).addSImm(Offset);
}
/// addFrameReference - This function is used to add a reference to the base of
/// an abstract object on the stack frame of the current function. This
/// reference has base register <noreg> and a FrameIndex offset until it is
/// resolved.
///
inline const MachineInstrBuilder &
addFrameReference(const MachineInstrBuilder &MIB, int FI) {
return MIB.addReg(0).addZImm(1).addMReg(0).addFrameIndex(FI);
}
#endif