Target Definition for MicroBlaze

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Target Definition for MicroBlaze

Wesley Peck
I have recently committed a LLVM backend for the MicroBlaze soft-processor to the LLVM repository. Attached is a Clang target definition for the new LLVM backend. I followed the example of other backends when creating this file. The only thing I was unsure about was how to support the MicroBlaze specific intrinsics.

In all of the examples that I found the processor specific intrinsics were included in the main top level LLVM Intrinsic definitions (include/llvm/Intrinsics.td) but my backend does not include the processor specific intrinsics in the top level file. It defines them inside of the MicroBlaze target definition (lib/Target/MBlaze/MBlazeIntrinsics.td). This was done at the request of the LLVM developers.

I solved this problem by modifying the Makefile for CodeGen so that the LLVM source and object directories were included on the C++ include path. I could then include the MicroBlaze specific intrinsic info file which gives me access to helper functions which return a intrinsic id given the GCC builtin name.

Whoever reviews the patch may want to look especially close at how this is done because it differs from what the other backends seemed to be doing.




Thank you,

--
Wesley Peck
University of Kansas
SLDG Laboratory


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

2010-02-24-mblaze-clang.patch.gz (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Target Definition for MicroBlaze

Chris Lattner
On Feb 24, 2010, at 12:34 PM, Wesley Peck wrote:
> I have recently committed a LLVM backend for the MicroBlaze soft-processor to the LLVM repository. Attached is a Clang target definition for the new LLVM backend. I followed the example of other backends when creating this file. The only thing I was unsure about was how to support the MicroBlaze specific intrinsics.

The targets change looks good to me, but I don't like the #include of lib/Target/MBlaze/MBlazeIntrinsicInfo.h and the makefile change, please feel free to submit them.

> In all of the examples that I found the processor specific intrinsics were included in the main top level LLVM Intrinsic definitions (include/llvm/Intrinsics.td) but my backend does not include the processor specific intrinsics in the top level file. It defines them inside of the MicroBlaze target definition (lib/Target/MBlaze/MBlazeIntrinsics.td). This was done at the request of the LLVM developers.

Right.

> I solved this problem by modifying the Makefile for CodeGen so that the LLVM source and object directories were included on the C++ include path. I could then include the MicroBlaze specific intrinsic info file which gives me access to helper functions which return a intrinsic id given the GCC builtin name.
>
> Whoever reviews the patch may want to look especially close at how this is done because it differs from what the other backends seemed to be doing.

I'm not really thrilled with this.  Instead of creating an instance of MBlazeIntrinsicInfo, can't you get the TargetIntrinsicInfo* from the target machine in a target independent way?

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target Definition for MicroBlaze

Wesley Peck
On Feb 26, 2010, at 12:47 PM, Chris Lattner wrote:

> I'm not really thrilled with this.  Instead of creating an instance of MBlazeIntrinsicInfo, can't you get the TargetIntrinsicInfo* from the target machine in a target independent way?

I am a little bit confused about what you are asking here. Do you mean that I shouldn't use MBlazeIntrinsicInfo at all or that I should move its use to inside of the class MBlazeTargetInfo (inside of lib/Basic/Targets.cpp)?

Thanks for the feed back.

--
Wesley Peck
University of Kansas
SLDG Laboratory


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target Definition for MicroBlaze

Chris Lattner

On Feb 26, 2010, at 11:39 AM, Wesley Peck wrote:

> On Feb 26, 2010, at 12:47 PM, Chris Lattner wrote:
>
>> I'm not really thrilled with this.  Instead of creating an instance of MBlazeIntrinsicInfo, can't you get the TargetIntrinsicInfo* from the target machine in a target independent way?
>
> I am a little bit confused about what you are asking here. Do you mean that I shouldn't use MBlazeIntrinsicInfo at all or that I should move its use to inside of the class MBlazeTargetInfo (inside of lib/Basic/Targets.cpp)?

I'm saying that it shouldn't *directly* use MBlazeIntrinsicInfo at all: Given a TargetMachine object (which will your MBlaze TargetMachine), clang should call the TM.getIntrinsicInfo() method, which will return the existing MBlazeIntrinsicInfo object without clang having to know about mblaze directly.

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target Definition for MicroBlaze

Jakob Stoklund Olesen

On Feb 26, 2010, at 1:12 PM, Chris Lattner wrote:

>
> On Feb 26, 2010, at 11:39 AM, Wesley Peck wrote:
>
>> On Feb 26, 2010, at 12:47 PM, Chris Lattner wrote:
>>
>>> I'm not really thrilled with this.  Instead of creating an instance of MBlazeIntrinsicInfo, can't you get the TargetIntrinsicInfo* from the target machine in a target independent way?
>>
>> I am a little bit confused about what you are asking here. Do you mean that I shouldn't use MBlazeIntrinsicInfo at all or that I should move its use to inside of the class MBlazeTargetInfo (inside of lib/Basic/Targets.cpp)?
>
> I'm saying that it shouldn't *directly* use MBlazeIntrinsicInfo at all: Given a TargetMachine object (which will your MBlaze TargetMachine), clang should call the TM.getIntrinsicInfo() method, which will return the existing MBlazeIntrinsicInfo object without clang having to know about mblaze directly.

So probably getIntrinsicForGCCBuiltin() needs to be added to TargetIntrinsicInfo? It doesn't currently exist.

/jakob


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target Definition for MicroBlaze

Chris Lattner

On Feb 26, 2010, at 3:58 PM, Jakob Stoklund Olesen wrote:

>>> I am a little bit confused about what you are asking here. Do you mean that I shouldn't use MBlazeIntrinsicInfo at all or that I should move its use to inside of the class MBlazeTargetInfo (inside of lib/Basic/Targets.cpp)?
>>
>> I'm saying that it shouldn't *directly* use MBlazeIntrinsicInfo at all: Given a TargetMachine object (which will your MBlaze TargetMachine), clang should call the TM.getIntrinsicInfo() method, which will return the existing MBlazeIntrinsicInfo object without clang having to know about mblaze directly.
>
> So probably getIntrinsicForGCCBuiltin() needs to be added to TargetIntrinsicInfo? It doesn't currently exist.

Ah, quite likely!

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev