[LLVMdev] LLVM IR, Instructions, Backend, AsmPrinter

pratik dand pratikdand143 at gmail.com
Thu Jun 19 20:10:15 PDT 2014


Dear John,

Since the pass that I have can transform IR, I was thinking to put in an
inline assembly code using the module asm in llvm.

Replacing the llvm IR instruction %tmp4 = add nsw i32 %tmp2, %tmp3 by
something like  module asm "ADDenc dst,src1,src2" (instruction in the new
X86 architecture).

But here I am not sure about the register allocation to tmp4,tmp2 and tmp3.
Can you comment?

Regards,
Pratik


On Wed, Jun 18, 2014 at 11:20 PM, John Criswell <criswell at illinois.edu>
wrote:

>  On 6/18/14, 3:01 AM, pratik dand wrote:
>
> Dear,
>
>  I am new to llvm and hence have very little idea about a problem that is
> my university project.
> I am supposed to assume a X86 CPU supporting an instruction ADDenc that
> adds two encrypted operands. The original ADD also exists and should
> operate on unencrypted operands.
>
>  My task is to transform C programs into the new X86 assembly that
> supports ADDenc. I have very little idea about this.
>
>  I have been suggested the following approaches
>  1) Adding a new Instruction ADDenc in the current X86 LLVM backend and
> make the necessary changes.
> 2) Adding a new LLVM IR instruction addenc that recognises the operands at
> this level instead of general LLVM add, then add an instruction in the
> target X86 to transform addenc of LLVM to ADDenc of X86.
>
>
> There is a third option: if you have an assembler that understands the new
> ADDenc instruction, you can probably add inline assembly code that performs
> the AddEnc instruction.  This will only work if you're doing ahead-of-time
> compilation and clang is configured to use your new assembler, but if
> you're transforming C code, that is most likely what you're doing.
>
> That said, if you're sufficiently confident with working with the LLVM
> code generator, I think you should add support for the AddEnc instruction
> in the X86 Backend.  As to whether you should add an intrinsic or modify
> the backend to just figure out where to use AddEnc, I'm guessing that
> adding an intrinsic would be better, but people more familiar with the code
> generator infrastructure should comment.
>
> Regards,
>
> John Criswell
>
>
>
>  I have been given an LLVM pass that can run on LLVM IR and decide which
> are the encrypted operands.
>
>  Any help of any kind will be helpful as I know very little about LLVM.
>
>  --
> Pratik
>
>
>
> _______________________________________________
> LLVM Developers mailing listLLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>


-- 
Pratik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140620/216cd083/attachment.html>


More information about the llvm-dev mailing list