]> granicus.if.org Git - llvm/commitdiff
[AVR] Add argument indices to the instrumention hook functions
authorDylan McKay <dylanmckay34@gmail.com>
Thu, 15 Dec 2016 09:38:09 +0000 (09:38 +0000)
committerDylan McKay <dylanmckay34@gmail.com>
Thu, 15 Dec 2016 09:38:09 +0000 (09:38 +0000)
This allows the instrumention hook functions to do better
pretty-printing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289793 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AVR/AVRInstrumentFunctions.cpp

index ae2428e5e1e32a078dc96b43a5a7eadb1cc466c7..a2f20e02be1fa0a5f116ced1b2eb710ec94c41a4 100644 (file)
@@ -117,14 +117,16 @@ static void BuildArgument(BasicBlock &BB, Argument &Arg) {
   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);
 }