From 8cf77137533f1d83f9ea0085b5ca6d241f4bab9a Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 3 Dec 2008 18:11:40 +0000 Subject: Extend X86's addFrameReference to add a MachineMemOperand for the frame reference. This will help post-RA scheduling determine that spills to distinct stack slots are independent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60486 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrBuilder.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/Target') diff --git a/lib/Target/X86/X86InstrBuilder.h b/lib/Target/X86/X86InstrBuilder.h index 87c63421bc..74f9e05ffe 100644 --- a/lib/Target/X86/X86InstrBuilder.h +++ b/lib/Target/X86/X86InstrBuilder.h @@ -24,7 +24,9 @@ #ifndef X86INSTRBUILDER_H #define X86INSTRBUILDER_H +#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/PseudoSourceValue.h" namespace llvm { @@ -109,7 +111,22 @@ inline const MachineInstrBuilder &addFullAddress(const MachineInstrBuilder &MIB, /// inline const MachineInstrBuilder & addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0) { - return MIB.addFrameIndex(FI).addImm(1).addReg(0).addImm(Offset); + MachineInstr *MI = MIB; + MachineFunction &MF = *MI->getParent()->getParent(); + MachineFrameInfo &MFI = *MF.getFrameInfo(); + const TargetInstrDesc &TID = MI->getDesc(); + unsigned Flags = 0; + if (TID.mayLoad()) + Flags |= MachineMemOperand::MOLoad; + if (TID.mayStore()) + Flags |= MachineMemOperand::MOStore; + MachineMemOperand MMO(PseudoSourceValue::getFixedStack(FI), + Flags, + MFI.getObjectOffset(FI) + Offset, + MFI.getObjectSize(FI), + MFI.getObjectAlignment(FI)); + return MIB.addFrameIndex(FI).addImm(1).addReg(0).addImm(Offset) + .addMemOperand(MMO); } /// addConstantPoolReference - This function is used to add a reference to the -- cgit v1.2.3-18-g5258