[llvm-dev] Upper 32bits from 64bit value

Sandeep Kumar Singh via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 6 22:51:29 PDT 2015


Hi All,

Is this possible to generate LLVM IR from any static/dynamic link library?
I have some static and dynamic link library and I want to generate LLVM IR
as I want to obfuscate these libraries.
Is there any way to do the same.

Please give me some pointers on this.

Thanks,
Deep

On Mon, Sep 28, 2015 at 9:04 AM, Sandeep Kumar Singh <deepdondo007 at gmail.com
> wrote:

> Hi Tim,
>
> Thank you for reply.
>
> > llvm::Value *intermediateValue = LLVMIRBuilder->CreateLShr(x64BitValue,
> 32);
> Now I am using below to calculate upper 32bits, I think this is OK,
> llvm::Value *intermediateValue = LLVMIRBuilder->CreateAnd(x64BitValue,
> 0xFFFFFFFF00000000);
> intermediateValue = LLVMIRBuilder->CreateLShr(intermediateValue, 32);
>     //cast value to 32 bit
>     intermediateValue = castValueByOpSize(intermediateValue, 32);
>
>
> Regards,
> Deep
>
> On Fri, Sep 25, 2015 at 7:12 PM, Tim Northover <t.p.northover at gmail.com>
> wrote:
>
>> On 24 September 2015 at 22:12, Sandeep Kumar Singh via llvm-dev
>> <llvm-dev at lists.llvm.org> wrote:
>> > I need to fetch lower and higher 32bits from 64bit value. I found
>> > "CreateLShr" function to fetch lower 32bits,
>> > llvm::Value *intermediateValue = LLVMIRBuilder->CreateLShr(x64BitValue,
>> 32);
>>
>> That would give you the upper bits, I think.
>>
>> > What function I need to use for fetching upper 32bits from 64bit value.
>>
>> There's multiple ways to get the other half: "x & 0xffffffff" is the
>> canonical one (LLVM's optimisers will convert the others into that if
>> they can).
>>
>> Cheers.
>>
>> Tim.
>>
>
>
>
> --
>
> Thanks and Regards,
> Sandeep Kumar Singh
>



-- 

Thanks and Regards,
Sandeep Kumar Singh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151007/644b681a/attachment.html>


More information about the llvm-dev mailing list