[LLVMdev] printing
John McCall
rjmccall at apple.com
Wed Dec 8 23:36:54 PST 2010
On Dec 8, 2010, at 10:45 PM, Jonas Paulsson wrote:
> I have made some usigned ConstantInt's, and when I print them (dump()), they are printed as signed always. Why is this? I do not know how to change the debug format for them.
Values of the integer types in LLVM are really bit-patterns, not values; whether a value is signed or unsigned is a meaning that you impose on the value, not something inherent in the value. So the choice of how to dump is basically arbitrary, but I think the basic reasoning is that:
- we want to print as decimal, because the most important cases are small positive numbers, and printing those in hex would be obnoxious
- small negative numbers all look like each other when they've been printed as their unsigned equivalents
- large unsigned numbers are usually bitmasks anyway, so the mere act of printing them in decimal will already obscure their meaning
John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101208/1e8c6c11/attachment.html>
More information about the llvm-dev
mailing list