Add a backend

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

Add a backend

Daniel Dilts
In attempting to add a backend I came across the documentation here: http://llvm.org/docs/WritingAnLLVMBackend.html

The section on the build system seems to be out of date, or maybe I don't understand it.  I copied the Sparc target to a directory (Foo for the example), added Foo to the subdirectories list in llvm\lib\Target\LLVMBuild.txt and to LLVM_ALL_TARGETS in llvm\CMakeLists.txt.  I removed the files except for FooTargetMachine.cpp and FooTargetMachine.h.

FooTargetMachine is not completed yet, but I was trying to compile and get linker errors about _LLVMInitializeFooTargetMC referenced in function void llvm::InitializeAllTargetMCs(void).  I do not see anything about how to implement this function.

Is there additional documentation about how to implement a backend that I am missing?

_______________________________________________
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: Add a backend

Anton Korobeynikov-2
This function is autogenerated. You need also to change top-level
configure / cmake files.

On Sat, Mar 14, 2015 at 8:38 AM, Daniel Dilts <[hidden email]> wrote:

> In attempting to add a backend I came across the documentation here:
> http://llvm.org/docs/WritingAnLLVMBackend.html
>
> The section on the build system seems to be out of date, or maybe I don't
> understand it.  I copied the Sparc target to a directory (Foo for the
> example), added Foo to the subdirectories list in
> llvm\lib\Target\LLVMBuild.txt and to LLVM_ALL_TARGETS in
> llvm\CMakeLists.txt.  I removed the files except for FooTargetMachine.cpp
> and FooTargetMachine.h.
>
> FooTargetMachine is not completed yet, but I was trying to compile and get
> linker errors about _LLVMInitializeFooTargetMC referenced in function void
> llvm::InitializeAllTargetMCs(void).  I do not see anything about how to
> implement this function.
>
> Is there additional documentation about how to implement a backend that I am
> missing?
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



--
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: Add a backend

Daniel Dilts
Yes, llvm::InitializeAllTargetMCs(void) does seem to be autogenerated.  It is _LLVMInitializeFooTargetMC that I can't find documented anywhere.

On Sat, Mar 14, 2015 at 12:05 AM, Anton Korobeynikov <[hidden email]> wrote:
This function is autogenerated. You need also to change top-level
configure / cmake files.

On Sat, Mar 14, 2015 at 8:38 AM, Daniel Dilts <[hidden email]> wrote:
> In attempting to add a backend I came across the documentation here:
> http://llvm.org/docs/WritingAnLLVMBackend.html
>
> The section on the build system seems to be out of date, or maybe I don't
> understand it.  I copied the Sparc target to a directory (Foo for the
> example), added Foo to the subdirectories list in
> llvm\lib\Target\LLVMBuild.txt and to LLVM_ALL_TARGETS in
> llvm\CMakeLists.txt.  I removed the files except for FooTargetMachine.cpp
> and FooTargetMachine.h.
>
> FooTargetMachine is not completed yet, but I was trying to compile and get
> linker errors about _LLVMInitializeFooTargetMC referenced in function void
> llvm::InitializeAllTargetMCs(void).  I do not see anything about how to
> implement this function.
>
> Is there additional documentation about how to implement a backend that I am
> missing?
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



--
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: Add a backend

Anton Korobeynikov-2
You have to provide this function and initialize the whole MC infrastructure.

See e.g. lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp

On Sat, Mar 14, 2015 at 10:11 AM, Daniel Dilts <[hidden email]> wrote:

> Yes, llvm::InitializeAllTargetMCs(void) does seem to be autogenerated.  It
> is _LLVMInitializeFooTargetMC that I can't find documented anywhere.
>
> On Sat, Mar 14, 2015 at 12:05 AM, Anton Korobeynikov
> <[hidden email]> wrote:
>>
>> This function is autogenerated. You need also to change top-level
>> configure / cmake files.
>>
>> On Sat, Mar 14, 2015 at 8:38 AM, Daniel Dilts <[hidden email]> wrote:
>> > In attempting to add a backend I came across the documentation here:
>> > http://llvm.org/docs/WritingAnLLVMBackend.html
>> >
>> > The section on the build system seems to be out of date, or maybe I
>> > don't
>> > understand it.  I copied the Sparc target to a directory (Foo for the
>> > example), added Foo to the subdirectories list in
>> > llvm\lib\Target\LLVMBuild.txt and to LLVM_ALL_TARGETS in
>> > llvm\CMakeLists.txt.  I removed the files except for
>> > FooTargetMachine.cpp
>> > and FooTargetMachine.h.
>> >
>> > FooTargetMachine is not completed yet, but I was trying to compile and
>> > get
>> > linker errors about _LLVMInitializeFooTargetMC referenced in function
>> > void
>> > llvm::InitializeAllTargetMCs(void).  I do not see anything about how to
>> > implement this function.
>> >
>> > Is there additional documentation about how to implement a backend that
>> > I am
>> > missing?
>> >
>> > _______________________________________________
>> > LLVM Developers mailing list
>> > [hidden email]         http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >
>>
>>
>>
>> --
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
>



--
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: Add a backend

Daniel Dilts
Is there documentation somewhere about exactly what the function is supposed to do, or do I have to figure it out from existing examples?

On Sat, Mar 14, 2015 at 12:13 AM, Anton Korobeynikov <[hidden email]> wrote:
You have to provide this function and initialize the whole MC infrastructure.

See e.g. lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp

On Sat, Mar 14, 2015 at 10:11 AM, Daniel Dilts <[hidden email]> wrote:
> Yes, llvm::InitializeAllTargetMCs(void) does seem to be autogenerated.  It
> is _LLVMInitializeFooTargetMC that I can't find documented anywhere.
>
> On Sat, Mar 14, 2015 at 12:05 AM, Anton Korobeynikov
> <[hidden email]> wrote:
>>
>> This function is autogenerated. You need also to change top-level
>> configure / cmake files.
>>
>> On Sat, Mar 14, 2015 at 8:38 AM, Daniel Dilts <[hidden email]> wrote:
>> > In attempting to add a backend I came across the documentation here:
>> > http://llvm.org/docs/WritingAnLLVMBackend.html
>> >
>> > The section on the build system seems to be out of date, or maybe I
>> > don't
>> > understand it.  I copied the Sparc target to a directory (Foo for the
>> > example), added Foo to the subdirectories list in
>> > llvm\lib\Target\LLVMBuild.txt and to LLVM_ALL_TARGETS in
>> > llvm\CMakeLists.txt.  I removed the files except for
>> > FooTargetMachine.cpp
>> > and FooTargetMachine.h.
>> >
>> > FooTargetMachine is not completed yet, but I was trying to compile and
>> > get
>> > linker errors about _LLVMInitializeFooTargetMC referenced in function
>> > void
>> > llvm::InitializeAllTargetMCs(void).  I do not see anything about how to
>> > implement this function.
>> >
>> > Is there additional documentation about how to implement a backend that
>> > I am
>> > missing?
>> >
>> > _______________________________________________
>> > LLVM Developers mailing list
>> > [hidden email]         http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >
>>
>>
>>
>> --
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
>



--
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: Add a backend

suyog sarda

Hi,

There is a good documentation for writing a backend for sample architecture CPU0.

Please refer this pdf

https://www.google.co.in/url?sa=t&source=web&rct=j&ei=xhkEVaH-DJO2uATshIKIBw&url=http://jonathan2251.github.io/lbd/TutorialLLVMBackendCpu0.pdf&ved=0CBsQFjAA&usg=AFQjCNFZR2uFivZlsfCuZbMzyJmKJUV7Vg

Regards,
Suyog

Is there documentation somewhere about exactly what the function is supposed to do, or do I have to figure it out from existing examples?

On Sat, Mar 14, 2015 at 12:13 AM, Anton Korobeynikov <[hidden email]> wrote:
You have to provide this function and initialize the whole MC infrastructure.

See e.g. lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp

On Sat, Mar 14, 2015 at 10:11 AM, Daniel Dilts <[hidden email]> wrote:
> Yes, llvm::InitializeAllTargetMCs(void) does seem to be autogenerated.  It
> is _LLVMInitializeFooTargetMC that I can't find documented anywhere.
>
> On Sat, Mar 14, 2015 at 12:05 AM, Anton Korobeynikov
> <[hidden email]> wrote:
>>
>> This function is autogenerated. You need also to change top-level
>> configure / cmake files.
>>
>> On Sat, Mar 14, 2015 at 8:38 AM, Daniel Dilts <[hidden email]> wrote:
>> > In attempting to add a backend I came across the documentation here:
>> > http://llvm.org/docs/WritingAnLLVMBackend.html
>> >
>> > The section on the build system seems to be out of date, or maybe I
>> > don't
>> > understand it.  I copied the Sparc target to a directory (Foo for the
>> > example), added Foo to the subdirectories list in
>> > llvm\lib\Target\LLVMBuild.txt and to LLVM_ALL_TARGETS in
>> > llvm\CMakeLists.txt.  I removed the files except for
>> > FooTargetMachine.cpp
>> > and FooTargetMachine.h.
>> >
>> > FooTargetMachine is not completed yet, but I was trying to compile and
>> > get
>> > linker errors about _LLVMInitializeFooTargetMC referenced in function
>> > void
>> > llvm::InitializeAllTargetMCs(void).  I do not see anything about how to
>> > implement this function.
>> >
>> > Is there additional documentation about how to implement a backend that
>> > I am
>> > missing?
>> >
>> > _______________________________________________
>> > LLVM Developers mailing list
>> > [hidden email]         http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >
>>
>>
>>
>> --
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
>



--
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


_______________________________________________
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: Add a backend

Daniel Dilts
That appears to be very thorough.  Thank you for the link.  It isn't that I am not willing to go through the documentation provided by LLVM and figure out what is missing, I find, though, that it is much faster if I accumulate as much documentation as possible up front.

On Sat, Mar 14, 2015 at 4:22 AM, suyog sarda <[hidden email]> wrote:

Hi,

There is a good documentation for writing a backend for sample architecture CPU0.

Please refer this pdf

https://www.google.co.in/url?sa=t&source=web&rct=j&ei=xhkEVaH-DJO2uATshIKIBw&url=http://jonathan2251.github.io/lbd/TutorialLLVMBackendCpu0.pdf&ved=0CBsQFjAA&usg=AFQjCNFZR2uFivZlsfCuZbMzyJmKJUV7Vg

Regards,
Suyog

Is there documentation somewhere about exactly what the function is supposed to do, or do I have to figure it out from existing examples?

On Sat, Mar 14, 2015 at 12:13 AM, Anton Korobeynikov <[hidden email]> wrote:
You have to provide this function and initialize the whole MC infrastructure.

See e.g. lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp

On Sat, Mar 14, 2015 at 10:11 AM, Daniel Dilts <[hidden email]> wrote:
> Yes, llvm::InitializeAllTargetMCs(void) does seem to be autogenerated.  It
> is _LLVMInitializeFooTargetMC that I can't find documented anywhere.
>
> On Sat, Mar 14, 2015 at 12:05 AM, Anton Korobeynikov
> <[hidden email]> wrote:
>>
>> This function is autogenerated. You need also to change top-level
>> configure / cmake files.
>>
>> On Sat, Mar 14, 2015 at 8:38 AM, Daniel Dilts <[hidden email]> wrote:
>> > In attempting to add a backend I came across the documentation here:
>> > http://llvm.org/docs/WritingAnLLVMBackend.html
>> >
>> > The section on the build system seems to be out of date, or maybe I
>> > don't
>> > understand it.  I copied the Sparc target to a directory (Foo for the
>> > example), added Foo to the subdirectories list in
>> > llvm\lib\Target\LLVMBuild.txt and to LLVM_ALL_TARGETS in
>> > llvm\CMakeLists.txt.  I removed the files except for
>> > FooTargetMachine.cpp
>> > and FooTargetMachine.h.
>> >
>> > FooTargetMachine is not completed yet, but I was trying to compile and
>> > get
>> > linker errors about _LLVMInitializeFooTargetMC referenced in function
>> > void
>> > llvm::InitializeAllTargetMCs(void).  I do not see anything about how to
>> > implement this function.
>> >
>> > Is there additional documentation about how to implement a backend that
>> > I am
>> > missing?
>> >
>> > _______________________________________________
>> > LLVM Developers mailing list
>> > [hidden email]         http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> >
>>
>>
>>
>> --
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
>



--
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



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