diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-12-14 22:34:10 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-12-14 22:34:10 +0000 |
commit | 45d0bf280d063a9ae32f4f47c3cb3f376dcbcd24 (patch) | |
tree | 3ac2716f4f0fb5b5ab7489ac714e861ffca004cd /include | |
parent | ece9b23b5453aaaa4273af66b442a92ecd8bf665 (diff) |
TLI: Allow using PSV for intrinsic mem operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/MachineMemOperand.h | 15 | ||||
-rw-r--r-- | include/llvm/CodeGen/TargetLowering.h | 6 |
2 files changed, 19 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h index 971244897f9..c5b204a79f0 100644 --- a/include/llvm/CodeGen/MachineMemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -47,7 +47,7 @@ struct MachinePointerInfo { uint8_t StackID; - unsigned AddrSpace; + unsigned AddrSpace = 0; explicit MachinePointerInfo(const Value *v, int64_t offset = 0, uint8_t ID = 0) @@ -65,6 +65,19 @@ struct MachinePointerInfo { : V((const Value *)nullptr), Offset(0), StackID(0), AddrSpace(AddressSpace) {} + explicit MachinePointerInfo( + PointerUnion<const Value *, const PseudoSourceValue *> v, + int64_t offset = 0, + uint8_t ID = 0) + : V(v), Offset(offset), StackID(ID) { + if (V) { + if (const auto *ValPtr = V.dyn_cast<const Value*>()) + AddrSpace = ValPtr->getType()->getPointerAddressSpace(); + else + AddrSpace = V.get<const PseudoSourceValue*>()->getAddressSpace(); + } + } + MachinePointerInfo getWithOffset(int64_t O) const { if (V.isNull()) return MachinePointerInfo(AddrSpace); diff --git a/include/llvm/CodeGen/TargetLowering.h b/include/llvm/CodeGen/TargetLowering.h index cbe38af7d1f..0fa19d09e77 100644 --- a/include/llvm/CodeGen/TargetLowering.h +++ b/include/llvm/CodeGen/TargetLowering.h @@ -702,7 +702,10 @@ public: struct IntrinsicInfo { unsigned opc = 0; // target opcode EVT memVT; // memory VT - const Value* ptrVal = nullptr; // value representing memory location + + // value representing memory location + PointerUnion<const Value *, const PseudoSourceValue *> ptrVal; + int offset = 0; // offset off of ptrVal unsigned size = 0; // the size of the memory location // (taken from memVT if zero) @@ -717,6 +720,7 @@ public: /// true and store the intrinsic information into the IntrinsicInfo that was /// passed to the function. virtual bool getTgtMemIntrinsic(IntrinsicInfo &, const CallInst &, + MachineFunction &, unsigned /*Intrinsic*/) const { return false; } |