fix compilation with llvm 5 and older
@@ -223,7 +223,11 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
BuildMI(MBB, I, DL, get(plugin_->getStore(RC))).addFrameIndex(FI).addImm(0)
.addReg(SrcReg, getKillRegState(isKill));
+#ifdef LLVM_OLDER_THAN_6
+ LLVMContext& context = MBB.getParent()->getFunction()->getContext();
+#else
LLVMContext& context = MBB.getParent()->getFunction().getContext();
+#endif
llvm::Metadata* md = llvm::MDString::get(context, "AA_CATEGORY_STACK_SLOT");
MDNode* mdNode =
MDNode::get(context, llvm::ArrayRef<llvm::Metadata*>(&md, 1));
@@ -243,7 +247,11 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
BuildMI(MBB, I, DL, get(plugin_->getLoad(RC)), DestReg).addFrameIndex(FI)
.addImm(0);
+#ifdef LLVM_OLDER_THAN_6
+ LLVMContext& context = MBB.getParent()->getFunction()->getContext();
+#else
LLVMContext& context = MBB.getParent()->getFunction().getContext();
+#endif
llvm::Metadata* md = llvm::MDString::get(context, "AA_CATEGORY_STACK_SLOT");
MDNode* mdNode =
MDNode::get(context, llvm::ArrayRef<llvm::Metadata*>(&md, 1));
