Casting a Value

Hi,

I have Value V of Type i32*. How can I convert/set it's Type to i32?

Or How can I create another Value of Type i32 and with same name as V.
I have tried

Value *NewV = new Value(Type,scid);
NewV->setName(V->getNameStr());

It causes stack dump. I am not sure as second argument in the Value
constructor as scid (SubClassID). So I have mentioned 0.

Any Idea how to do this?

Regards,
Chayan

Hi,

I have Value V of Type i32*. How can I convert/set it's Type to i32?

You can use the ptrtoint instruction.

Or How can I create another Value of Type i32 and with same name as V.
I have tried

Value *NewV = new Value(Type,scid);
NewV->setName(V->getNameStr());

It causes stack dump. I am not sure as second argument in the Value
constructor as scid (SubClassID). So I have mentioned 0.

Any Idea how to do this?

Value is an abstract class, you're not supposed to be able to new it directly. Please make a subclass. I'll make the Value ctor protected.

-Chris