trying to generate a simple inline asm

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

trying to generate a simple inline asm

Reed Kotler
I'm trying to just emit simple inline assembler (no constraints, inputs,
etc.)

Can anyone point me to an example of this..?

This is corresponding to:

   __asm__ ("mfc1 $4,$f12");


This is what I tried but it's not correct.

       std::vector<llvm::Type *> AsmArgTypes;
       llvm::FunctionType *AsmFTy =
llvm::FunctionType::get(Type::getVoidTy(FStub->getContext()),
                                 AsmArgTypes, false);
       llvm::InlineAsm *IA =
         llvm::InlineAsm::get(AsmFTy, "mfc1 $$4,$$f12", "", true,
                              /* IsAlignStack */ false,
                              llvm::InlineAsm::AD_Intel);
       CallInst::Create(IA, BB);

Probably something stupid I'm doing. I'm debugging now but maybe someone
knows the answer.

TIA.

Reed




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: trying to generate a simple inline asm

Anton Korobeynikov-2
> I'm trying to just emit simple inline assembler (no constraints, inputs,
> etc.)
>
> Can anyone point me to an example of this..?
C++ backend is your friend here.

--
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: trying to generate a simple inline asm

Reed Kotler
On 04/21/2013 03:37 AM, Anton Korobeynikov wrote:
>> I'm trying to just emit simple inline assembler (no constraints, inputs,
>> etc.)
>>
>> Can anyone point me to an example of this..?
> C++ backend is your friend here.
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
That's where I'm looking. Unfortunately they are processing the general
case so it's a lot of information to dig though.

I'm working on it.


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: trying to generate a simple inline asm

Reed Kotler
In reply to this post by Reed Kotler
On 04/21/2013 03:10 AM, reed kotler wrote:

> I'm trying to just emit simple inline assembler (no constraints, inputs,
> etc.)
>
> Can anyone point me to an example of this..?
>
> This is corresponding to:
>
>    __asm__ ("mfc1 $4,$f12");
>
>
> This is what I tried but it's not correct.
>
>        std::vector<llvm::Type *> AsmArgTypes;
>        llvm::FunctionType *AsmFTy =
> llvm::FunctionType::get(Type::getVoidTy(FStub->getContext()),
>                                  AsmArgTypes, false);
>        llvm::InlineAsm *IA =
>          llvm::InlineAsm::get(AsmFTy, "mfc1 $$4,$$f12", "", true,
>                               /* IsAlignStack */ false,
>                               llvm::InlineAsm::AD_Intel);
>        CallInst::Create(IA, BB);
>
> Probably something stupid I'm doing. I'm debugging now but maybe someone
> knows the answer.
>
> TIA.
>
> Reed
I was close the first time. I derived this from the general clang
version and I guess you need to include the argument list, even though
it's null. Too many things to do to deep dive into all of that code
right now.

       std::vector<llvm::Value*> AsmArgs;

       CallInst::Create(IA, AsmArgs, "", BB);



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev