[LLVMdev] Casting a Value
clattner at apple.com
Mon Jun 21 09:18:37 PDT 2010
On Jun 21, 2010, at 4:35 AM, Chayan Sarkar wrote:
> 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);
> 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.
More information about the llvm-dev