search for: createtrunc

Displaying 7 results from an estimated 7 matches for "createtrunc".

2011 Jan 24
0
[LLVMdev] How to change the type of an Instruction?
...nserted into the BasicBlock so they can't be numbered, and also they don't have names. > What I am doing wrong? Suppose that you're going from i32 to i16. Your only choice with that particular pair of types is a truncate. So: IRBuilder builder(OldInst); Value *V0 = builder.CreateTrunc(Op0, Type::getInt16Ty()); Value *V1 = builder.CreateTrunc(Op1, Type::getInt16Ty()); Value *Add = builder.CreateNSWAdd(V0, V1, "test"); The IRBuilder will take care of the distinction between instructions and constants for you. Note that I have not tested the above code, it may ne...
2011 Jan 24
3
[LLVMdev] How to change the type of an Instruction?
...39;t be numbered, and also they don't have names. > > > What I am doing wrong? >> > > Suppose that you're going from i32 to i16. Your only choice with that > particular pair of types is a truncate. So: > > IRBuilder builder(OldInst); > Value *V0 = builder.CreateTrunc(Op0, Type::getInt16Ty()); > Value *V1 = builder.CreateTrunc(Op1, Type::getInt16Ty()); > Value *Add = builder.CreateNSWAdd(V0, V1, "test"); > > The IRBuilder will take care of the distinction between instructions and > constants for you. Note that I have not tested the abo...
2011 Jan 24
3
[LLVMdev] How to change the type of an Instruction?
Hi, Nick, thanks for the reply. I still have a problem: I only need to "clone" an Instruction, changing its type. That is, I would like to keep all characteristics of the old Instruction and create a new one only with a different type. I am trying create a new Instruction thus: %3 = add nsw i32 %1, %2 ; <i16> [#uses=2] //Old Instruction Value* Op0 = I->getOperand(0); Value*
2011 Jan 24
0
[LLVMdev] How to change the type of an Instruction?
...hey don't > have names. > > > What I am doing wrong? > > > Suppose that you're going from i32 to i16. Your only choice with > that particular pair of types is a truncate. So: > > IRBuilder builder(OldInst); > Value *V0 = builder.CreateTrunc(Op0, Type::getInt16Ty()); > Value *V1 = builder.CreateTrunc(Op1, Type::getInt16Ty()); > Value *Add = builder.CreateNSWAdd(V0, V1, "test"); > > The IRBuilder will take care of the distinction between > instructions and constants for you. Note that I have no...
2011 Jan 28
1
[LLVMdev] How to change the type of an Instruction?
...have names. >> >> >> What I am doing wrong? >>> >> >> Suppose that you're going from i32 to i16. Your only choice with that >> particular pair of types is a truncate. So: >> >> IRBuilder builder(OldInst); >> Value *V0 = builder.CreateTrunc(Op0, Type::getInt16Ty()); >> Value *V1 = builder.CreateTrunc(Op1, Type::getInt16Ty()); >> Value *Add = builder.CreateNSWAdd(V0, V1, "test"); >> >> The IRBuilder will take care of the distinction between instructions and >> constants for you. Note that I hav...
2007 Dec 17
0
[LLVMdev] Elsa and LLVM and LLVM submissions
...> = > =-------------------------------------------------------------------- > ===// > + // Instruction creation methods: Cast/Conversion Operators > + // > = > = > =-------------------------------------------------------------------- > ===// > + > + Value *CreateTrunc(Value *V, const Type *DestTy, const char *Name > = "") { > + return CreateCast(Instruction::Trunc, V, DestTy, Name); > + } > + Value *CreateZExt(Value *V, const Type *DestTy, const char *Name > = "") { > + return CreateCast(Instruction::ZExt, V, Des...
2007 Dec 17
2
[LLVMdev] Elsa and LLVM and LLVM submissions
Devang Patel wrote: > On Dec 15, 2007, at 12:15 PM, Richard Pennington wrote: > >> I got the current version of LLVM via svn yesterday and modified my >> code to >> use the LLVMFoldingBuilder. Very nice! >> >> My question is this: I noticed that the folding builder doesn't fold >> some >> operations, e.g. casts. Is there some reason why? If