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
// the function. This field has no meaning for a variable sized element.
int64_t SPOffset;
- StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM = false)
+ StackObject(uint64_t Sz, unsigned Al, int64_t SP = 0, bool IM = false)
: Size(Sz), Alignment(Al), isImmutable(IM), SPOffset(SP) {}
};
///
int CreateStackObject(uint64_t Size, unsigned Alignment) {
assert(Size != 0 && "Cannot allocate zero size stack objects!");
- Objects.push_back(StackObject(Size, Alignment, -1));
+ Objects.push_back(StackObject(Size, Alignment));
return (int)Objects.size()-NumFixedObjects-1;
}
///
int CreateVariableSizedObject() {
HasVarSizedObjects = true;
- Objects.push_back(StackObject(0, 1, -1));
+ Objects.push_back(StackObject(0, 1));
return (int)Objects.size()-NumFixedObjects-1;
}
MI->addOperand(MachineOperand::CreateES(FnName, Offset));
return *this;
}
+
+ const MachineInstrBuilder &addMemOperand(const MachineMemOperand &MMO) const {
+ MI->addMemOperand(*MI->getParent()->getParent(), MMO);
+ return *this;
+ }
};
/// BuildMI - Builder interface. Specify how to create the initial instruction
#ifndef X86INSTRBUILDER_H
#define X86INSTRBUILDER_H
+#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/CodeGen/PseudoSourceValue.h"
namespace llvm {
///
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