[LLVMdev] get value of int greater than 64 bit?

Benjamin Kramer benny.kra at gmail.com
Tue Jan 22 11:02:28 PST 2013


On 22.01.2013, at 19:47, Ryan Taylor <ryta1203 at gmail.com> wrote:

> I have an instruction:
> 
> Instruction:   %mask166 = and i128 %lvar_ins176, -18446462598732840961
> 
> I would like to get the value of the const above, I'm using getSExtValue; however, I obviously get an assert for "bit size" greater than 64 (since it's a i128 instruction).
> 
> So how else can I get this value?

getValue() gives you an APInt which is an integer class for arbitrary bit widths. It has methods for all the basic arithmetic ops, you can print it and much more, see APInt.h.

- Ben





More information about the llvm-dev mailing list