[LLVMdev] LLVM 2.0 and integer signedness

Chris Lattner sabre at nondot.org
Tue Jun 26 11:05:02 PDT 2007


On Tue, 26 Jun 2007, [ISO-8859-1] Alberto González wrote:
> I'm using LLVM to instrument C code to test the efectiveness of some
> methods of error detection with dynamic invariants (see http://
> citeseer.ist.psu.edu/hangal02tracking.html). I'm using also a range
> invariant (max an min values seen). The problem is that for those
> invariants, I need to know if the value is signed or not (0xFF can be
> -1 or 255, depending on signed/unsigned).

Why not track the value range as both signed and unsigned?  You have to be 
able to do this in any case, in order to handle "int -> uint" casts (for 
example).  At any particular point in the code, you can use the signed or 
unsigned range invariant based on whatever you need.

-Chris

> El 26/06/2007, a las 18:22, Chris Lattner escribió:
>
>> On Tue, 26 Jun 2007, [ISO-8859-1] Alberto González wrote:
>>> The problem is that what i'm instrumenting is loads and stores, plus
>>> function call arguments and return values, which have no signedness
>>> information.
>>
>> Why do you need this?
>>
>> -Chris
>>
>>> El 26/06/2007, a las 17:03, Anton Korobeynikov escribió:
>>>
>>>> Hello, Alberto.
>>>>
>>>>> I'm using llvm for instrumenting code, and I need to know if
>>>>> there's a way to
>>>>> difference between signed and unsigned Values of integer type
>>>>> during an
>>>>> optimization pass.
>>>> Types are signless in LLVM 2, operations are not. So, you should
>>>> probably inspect insts itself, not their operands.
>>>>
>>>> --
>>>> With best regards, Anton Korobeynikov.
>>>>
>>>> Faculty of Mathematics & Mechanics, Saint Petersburg State
>>>> University.
>>>>
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>
>> -Chris
>>
>> --
>> http://nondot.org/sabre/
>> http://llvm.org/_______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/


More information about the llvm-dev mailing list