Robert Baruch via llvm-dev
2017-Oct-14 20:15 UTC
[llvm-dev] What's LLVM{target}CodeGen vs {target}CodeGen?
Hi all, *TL;DR:* I have a target TMS9900CodeGen but cmake is looking for LLVMTMS9900 or LLVMTMS9900CodeGen which I don't have, and cmake dies. But the MSP430 target doesn't have that either, and cmake is happy with it. What am I missing? *The premise:* I may be making a huge mistake, but I'm trying to develop an LLVM backend. I'm writing up some notes while I do so, and I hope to update the documentation. However, I ran into a bit of a problem running cmake. Note that I built the trunk release just fine, right now I'm modifying it. *The setup:* My target is called TMS9900 because I'm a masochist, and I'm just trying to make a bare do-nothing skeleton to start with. I have this: lib/Target/TMS9900 - CMakeLists.txt - LLVMBuild.txt - TMS9900TargetMachine.cpp - TMS9900TargetMachine.h - TMS9900.td TMS9900TargetMachine is the barest class I could make. It derives from LLVMTargetMachine, and passes everything through (although it defines the DataLayout). CMakeLists.txt is also pretty small: set(LLVM_TARGET_DEFINITIONS TMS9900.td) add_llvm_library(TMS9900CodeGen TMS9900TargetMachine.cpp ) LLVMBuild.txt is as minimal as I could guess at: [common] subdirectories [component_0] type = TargetGroup name = TMS9900 parent = Target [component_1] type = Library name = TMS9900CodeGen parent = TMS9900 required_libraries = Analysis AsmPrinter CodeGen Core MC Scalar SelectionDAG Support Target TransformUtils add_to_library_groups = TMS9900 And finally, TMS9900.td contains: include "llvm/Target/Target.td" def TMS9900 : Target { } I also updated lib/Target/LLVMBuild.txt's [common] subdirectories to include TMS9900. *The punchline:* Now, I tried to run cmake: $ cd build $ cmake -G "Unix Makefiles" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=TMS9900 ../llvm ... stuff ... CMake Error at cmake/modules/LLVM-Config.cmake:178 (message): Target TMS9900 is not in the set of libraries. Call Stack (most recent call first): cmake/modules/AddLLVM.cmake:525 (llvm_map_components_to_libnames) cmake/modules/AddLLVM.cmake:574 (llvm_add_library) tools/lto/CMakeLists.txt:19 (add_llvm_library) (Line numbers may be off slightly, since I added some message() lines). So I tracked this error down to where LLVM-Config.cmake is looking for targets whose name, given {target}, is either LLVM{target} or LLVM{target}CodeGen. Of course, I have no such targets. The weird thing is that I looked at the MSP430 directory, and it does not have LLVMMSP430 or LLVMMSP430CodeGen, either. It just has MSP430CodeGen yet somehow that target works just fine. *What am I missing?* Thanks! --Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171014/8935bf87/attachment.html>
Justin Bogner via llvm-dev
2017-Oct-16 01:17 UTC
[llvm-dev] What's LLVM{target}CodeGen vs {target}CodeGen?
Robert Baruch via llvm-dev <llvm-dev at lists.llvm.org> writes:> Hi all, > > *TL;DR:* I have a target TMS9900CodeGen but cmake is looking for LLVMTMS9900 > or LLVMTMS9900CodeGen which I don't have, and cmake dies. But the MSP430 target > doesn't have that either, and cmake is happy with it. What am I missing? > > *The premise:* > > I may be making a huge mistake, but I'm trying to develop an LLVM backend. > I'm writing up some notes while I do so, and I hope to update the > documentation. However, I ran into a bit of a problem running cmake. Note > that I built the trunk release just fine, right now I'm modifying it. > > *The setup:* > > My target is called TMS9900 because I'm a masochist, and I'm just trying to > make a bare do-nothing skeleton to start with. I have this: > > lib/Target/TMS9900 > - CMakeLists.txt > - LLVMBuild.txt > - TMS9900TargetMachine.cpp > - TMS9900TargetMachine.h > - TMS9900.td > > TMS9900TargetMachine is the barest class I could make. It derives from > LLVMTargetMachine, and passes everything through (although it defines the > DataLayout). > > CMakeLists.txt is also pretty small: > > set(LLVM_TARGET_DEFINITIONS TMS9900.td) > > add_llvm_library(TMS9900CodeGen > TMS9900TargetMachine.cpp > )This should be add_llvm_target, rather than add_llvm_library. This does some extra work, including calling the target LLVMXYZ rather than just XYZ.> LLVMBuild.txt is as minimal as I could guess at: > > [common] > subdirectories > > [component_0] > type = TargetGroup > name = TMS9900 > parent = Target > > [component_1] > type = Library > name = TMS9900CodeGen > parent = TMS9900 > required_libraries = Analysis AsmPrinter CodeGen Core MC Scalar > SelectionDAG Support Target TransformUtils > add_to_library_groups = TMS9900 > > And finally, TMS9900.td contains: > > include "llvm/Target/Target.td" > def TMS9900 : Target { } > > I also updated lib/Target/LLVMBuild.txt's [common] subdirectories to > include TMS9900. > > *The punchline:* > > Now, I tried to run cmake: > > $ cd build > $ cmake -G "Unix Makefiles" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=TMS9900 > ../llvm > ... stuff ... > CMake Error at cmake/modules/LLVM-Config.cmake:178 (message): > Target TMS9900 is not in the set of libraries. > Call Stack (most recent call first): > cmake/modules/AddLLVM.cmake:525 (llvm_map_components_to_libnames) > cmake/modules/AddLLVM.cmake:574 (llvm_add_library) > tools/lto/CMakeLists.txt:19 (add_llvm_library) > > (Line numbers may be off slightly, since I added some message() lines). So > I tracked this error down to where LLVM-Config.cmake is looking for targets > whose name, given {target}, is either LLVM{target} or LLVM{target}CodeGen. > > Of course, I have no such targets. > > The weird thing is that I looked at the MSP430 directory, and it does not > have LLVMMSP430 or LLVMMSP430CodeGen, either. It just has MSP430CodeGen yet > somehow that target works just fine. > > *What am I missing?* > > Thanks! > > --Rob > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Robert Baruch via llvm-dev
2017-Oct-16 01:46 UTC
[llvm-dev] What's LLVM{target}CodeGen vs {target}CodeGen?
Thanks, that was it! Well-spotted! --Rob On Sun, Oct 15, 2017 at 6:17 PM Justin Bogner <mail at justinbogner.com> wrote:> Robert Baruch via llvm-dev <llvm-dev at lists.llvm.org> writes: > > Hi all, > > > > *TL;DR:* I have a target TMS9900CodeGen but cmake is looking for > LLVMTMS9900 > > or LLVMTMS9900CodeGen which I don't have, and cmake dies. But the MSP430 > target > > doesn't have that either, and cmake is happy with it. What am I missing? > > > > *The premise:* > > > > I may be making a huge mistake, but I'm trying to develop an LLVM > backend. > > I'm writing up some notes while I do so, and I hope to update the > > documentation. However, I ran into a bit of a problem running cmake. Note > > that I built the trunk release just fine, right now I'm modifying it. > > > > *The setup:* > > > > My target is called TMS9900 because I'm a masochist, and I'm just trying > to > > make a bare do-nothing skeleton to start with. I have this: > > > > lib/Target/TMS9900 > > - CMakeLists.txt > > - LLVMBuild.txt > > - TMS9900TargetMachine.cpp > > - TMS9900TargetMachine.h > > - TMS9900.td > > > > TMS9900TargetMachine is the barest class I could make. It derives from > > LLVMTargetMachine, and passes everything through (although it defines the > > DataLayout). > > > > CMakeLists.txt is also pretty small: > > > > set(LLVM_TARGET_DEFINITIONS TMS9900.td) > > > > add_llvm_library(TMS9900CodeGen > > TMS9900TargetMachine.cpp > > ) > > This should be add_llvm_target, rather than add_llvm_library. This does > some extra work, including calling the target LLVMXYZ rather than just > XYZ. > > > LLVMBuild.txt is as minimal as I could guess at: > > > > [common] > > subdirectories > > > > [component_0] > > type = TargetGroup > > name = TMS9900 > > parent = Target > > > > [component_1] > > type = Library > > name = TMS9900CodeGen > > parent = TMS9900 > > required_libraries = Analysis AsmPrinter CodeGen Core MC Scalar > > SelectionDAG Support Target TransformUtils > > add_to_library_groups = TMS9900 > > > > And finally, TMS9900.td contains: > > > > include "llvm/Target/Target.td" > > def TMS9900 : Target { } > > > > I also updated lib/Target/LLVMBuild.txt's [common] subdirectories to > > include TMS9900. > > > > *The punchline:* > > > > Now, I tried to run cmake: > > > > $ cd build > > $ cmake -G "Unix Makefiles" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=TMS9900 > > ../llvm > > ... stuff ... > > CMake Error at cmake/modules/LLVM-Config.cmake:178 (message): > > Target TMS9900 is not in the set of libraries. > > Call Stack (most recent call first): > > cmake/modules/AddLLVM.cmake:525 (llvm_map_components_to_libnames) > > cmake/modules/AddLLVM.cmake:574 (llvm_add_library) > > tools/lto/CMakeLists.txt:19 (add_llvm_library) > > > > (Line numbers may be off slightly, since I added some message() lines). > So > > I tracked this error down to where LLVM-Config.cmake is looking for > targets > > whose name, given {target}, is either LLVM{target} or > LLVM{target}CodeGen. > > > > Of course, I have no such targets. > > > > The weird thing is that I looked at the MSP430 directory, and it does not > > have LLVMMSP430 or LLVMMSP430CodeGen, either. It just has MSP430CodeGen > yet > > somehow that target works just fine. > > > > *What am I missing?* > > > > Thanks! > > > > --Rob > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171016/4da22d2f/attachment.html>