signedness of types


I currently would like to find out the signedness of a instruction. But
looking at the CBackend, it looks as if it is not that simple? So i have two
Is there an easier way than guessing as it is done in the CBackend?
Is there a reason for that signedness is not part of the instruction type?

Best regards

A lot of LLVM integer instructions don't naturally have a sign. For
example, signed addition and unsigned addition are exactly the same
operation in two's complement, so the LLVM assembly doesn't bother to
encode the signedness. The CBacked "guesses" because the necessary
information is completely gone.

If you haven't looked at, I'd
suggest taking a look; it precisely states the semantics of all the
LLVM instructions and intrinsics.


This is so because it avoids encoding many sign conversions, which makes the IR more transparent to optimization (and avoids sign conversions!). It's also a closer match to the hardware. LLVM used to have signed integer types.

— Gordon