[AVR] Add argument indices to the instrumention hook functions
This allows the instrumention hook functions to do better
pretty-printing.
llvm-svn: 289793
diff --git a/llvm/lib/Target/AVR/AVRInstrumentFunctions.cpp b/llvm/lib/Target/AVR/AVRInstrumentFunctions.cpp
index ae2428e..a2f20e0 100644
--- a/llvm/lib/Target/AVR/AVRInstrumentFunctions.cpp
+++ b/llvm/lib/Target/AVR/AVRInstrumentFunctions.cpp
@@ -117,14 +117,16 @@
Function &F = *Arg.getParent();
LLVMContext &Ctx = F.getContext();
+ Type *I8 = Type::getInt8Ty(Ctx);
+
FunctionType *FnType = FunctionType::get(Type::getVoidTy(Ctx),
- {Type::getInt8PtrTy(Ctx), Arg.getType()}, false);
+ {Type::getInt8PtrTy(Ctx), I8, Arg.getType()}, false);
Constant *Fn = F.getParent()->getOrInsertFunction(
GetArgumentSymbolName(Arg), FnType);
Value *ArgName = CreateStringPtr(BB, Arg.getName());
- Value *Args[] = {ArgName, &Arg};
+ Value *Args[] = {ArgName, ConstantInt::get(I8, Arg.getArgNo()), &Arg};
CallInst::Create(Fn, Args, "", &BB);
}