[LLVMdev] correct types for ArgumentList?

ret val retval386 at gmail.com
Sun Sep 4 09:09:06 PDT 2011


I forgot to mention that ptrType gets its value from
StoreInst::getValueOperand()::getType()

On Sat, Sep 3, 2011 at 8:07 PM, ret val <retval386 at gmail.com> wrote:
> I'm trying to create and insert a anonymous function that will make a
> assignment on a GlobalVariable, based on a existing StoreInst. Once I
> find this StoreInst(which provides me with 2 Value* objects for me to
> use) I need to pass it to my anonymous function so it can carry out
> the assignment. I can not get the correct types, at runtime I get a
> bad signature error.
>
> So basically the function is setup to take arguments like this:
>                vector<Type *> v_params;
>                v_params.push_back(ptrType);                                    /* Shadow */
>                v_params.push_back(ptrType);                                    /* New Value */
>                v_params.push_back(ptrType);                                    /* Pointer */
>                ArrayRef<Type *> a_params(v_params);
>
> Where the assignment will look something like this:
>                Value *val = newFunc->arg_begin();
>                Value *ptr = ++(newFunc->arg_begin());
>                new StoreInst(val, ptr, block);
>
> But the only way I know to call is it is like this:
>                vector<Value *> v_args;
>                v_args.push_back(shadow);
>                v_args.push_back(store->getValueOperand());
>                v_args.push_back(store->getPointerOperand());
>                ArrayRef<Value *> a_args(v_args);
>
> What is the correct way todo something like this? The full code for
> this simple pass is here: http://tinypaste.com/4df56
>
> Thank you
>




More information about the llvm-dev mailing list