[LLVMdev] signedness of types

Eli Friedman eli.friedman at gmail.com
Tue Jun 3 04:44:37 PDT 2008

On Tue, Jun 3, 2008 at 2:42 AM, ST <st at iss.tu-darmstadt.de> wrote:
> Hi
> 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
> questions:
> 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?

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 http://llvm.org/docs/LangRef.html, I'd
suggest taking a look; it precisely states the semantics of all the
LLVM instructions and intrinsics.


More information about the llvm-dev mailing list