Kevin Wooten
2010-May-27 06:48 UTC
[LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
This is certainly an option... but keeping up an LLVM backend for the 360 seems like a bit much work. Using Clang's rewriter requires no real low-level maintenance, just creating and maintaining a C library for support functions emitted by the compiler (e.g. objc_msgSend). It seems to create a backend for LLVM targeting the 360 I wouldn't need to create something that outputs XEX's anyway. My custom backend would effectively create object files that the 360's linker would have to be able to recognize. This would mean not only outputting all the correct ABI conforming code but the correct PDB debugging information as well. It seems much less, and easier, work to implement the support functions and run it through the standard xbox compiler as the ABI and debugging information are taken care of. On May 26, 2010, at 8:08 PM, Sherief Farouk wrote:> I'm slightly confused here, just to be clear: you're planning to go ObjC -> LLVM (via Clang or whatever) -> C, then use the 360 SDK compiler to build that, right? If that's the case, I think it'd be a better option than to use LLVM to directly generate XEXs, and you won't give the TCR guys fits (I checked the BAS TCRs, none of them say you can't do that, but the platform has some requirements regarding binary code that I doubt you'll get right without a lot of effort). If that is the pipeline you had in mind, have you attempted to run a Hello World app yet? Ran into any errors? > > - Sherief > > On May 26, 2010, at 8:20 PM, kdubb wrote: > >> We are looking at using Objective-C/C++ in a new game engine. Objective C's duality of being both very dynamic and very "C" gives us exactly what we need to make the SDK and engineering of games simpler. >> >> This means that we will need a way to compile it on all platforms our games will target. Currently the major platforms we are concerned with include... PC, Mac, XBox 360, PS3, iPhone. Now the PC, Mac, iPhone and PS3 are fairly simple. If we build our own OpenStep libraries we can simply use LLVM to compile directly to these platforms; the PS3 although proprietary uses GCC as a C/C++ compiler so I am assuming Objective-C can be used fairly simply. This leaves us with the XBox 360. >> >> The 360 is a special chip (PowerPC based) with, as far as I have researched, a special ABI (Windows derivative). I haven't the faintest clue of whether code from the LLVM PPC backend would even work on the 360, much less interoperate with the system libraries. So my formulated solution has become this: use an LLVM backend to output C code and then compile that code with using MS's XBox 360 compiler. I believe I have read that LLVM has a C backend already but I don't know how to select it. >> >> If I can get a proof of concept showing Objective-C code running on the 360 we are off to the races. Any help is appreciated just not sure if all the pieces/parts exist and/or what I am missing. So... is this feasible? If so... how do I get LLVM to output C code? >> >> Thanks, >> Kevin >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Jean-Daniel Dupas
2010-May-27 07:54 UTC
[LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
Le 27 mai 2010 à 08:48, Kevin Wooten a écrit :> This is certainly an option... but keeping up an LLVM backend for the 360 seems like a bit much work. Using Clang's rewriter requires no real low-level maintenance, just creating and maintaining a C library for support functions emitted by the compiler (e.g. objc_msgSend). >The clang rewriter is not the same than LLVM C backend. AFAIK, clang rewriter don't use llvm at all (as it does not perform codegen). It is just a source to source conversion. I don't know how it work yet, but if it is design to output code for the NeXT Runtime, you may have to tweak it to output code compatible with your runtim.> It seems to create a backend for LLVM targeting the 360 I wouldn't need to create something that outputs XEX's anyway. My custom backend would effectively create object files that the 360's linker would have to be able to recognize. This would mean not only outputting all the correct ABI conforming code but the correct PDB debugging information as well. It seems much less, and easier, work to implement the support functions and run it through the standard xbox compiler as the ABI and debugging information are taken care of. > > On May 26, 2010, at 8:08 PM, Sherief Farouk wrote: > >> I'm slightly confused here, just to be clear: you're planning to go ObjC -> LLVM (via Clang or whatever) -> C, then use the 360 SDK compiler to build that, right? If that's the case, I think it'd be a better option than to use LLVM to directly generate XEXs, and you won't give the TCR guys fits (I checked the BAS TCRs, none of them say you can't do that, but the platform has some requirements regarding binary code that I doubt you'll get right without a lot of effort). If that is the pipeline you had in mind, have you attempted to run a Hello World app yet? Ran into any errors? >> >> - Sherief >> >> On May 26, 2010, at 8:20 PM, kdubb wrote: >> >>> We are looking at using Objective-C/C++ in a new game engine. Objective C's duality of being both very dynamic and very "C" gives us exactly what we need to make the SDK and engineering of games simpler. >>> >>> This means that we will need a way to compile it on all platforms our games will target. Currently the major platforms we are concerned with include... PC, Mac, XBox 360, PS3, iPhone. Now the PC, Mac, iPhone and PS3 are fairly simple. If we build our own OpenStep libraries we can simply use LLVM to compile directly to these platforms; the PS3 although proprietary uses GCC as a C/C++ compiler so I am assuming Objective-C can be used fairly simply. This leaves us with the XBox 360. >>> >>> The 360 is a special chip (PowerPC based) with, as far as I have researched, a special ABI (Windows derivative). I haven't the faintest clue of whether code from the LLVM PPC backend would even work on the 360, much less interoperate with the system libraries. So my formulated solution has become this: use an LLVM backend to output C code and then compile that code with using MS's XBox 360 compiler. I believe I have read that LLVM has a C backend already but I don't know how to select it. >>> >>> If I can get a proof of concept showing Objective-C code running on the 360 we are off to the races. Any help is appreciated just not sure if all the pieces/parts exist and/or what I am missing. So... is this feasible? If so... how do I get LLVM to output C code? >>> >>> Thanks, >>> Kevin >>>-- Jean-Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100527/debb8116/attachment.html>
Kevin Wooten
2010-May-27 09:10 UTC
[LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
I believe you are correct, the Clang rewriter seems to stay completely inside the Clang universe. Although, I think you can argue whether or not Clang is part of LLVM (it is listed on the main page as a primary sub-project). Either way my point was to compare the "ease" of the two methods, the Clang rewriter or modifying LLVM's PPC backend to output object code. On May 27, 2010, at 12:54 AM, Jean-Daniel Dupas wrote:> > Le 27 mai 2010 à 08:48, Kevin Wooten a écrit : > >> This is certainly an option... but keeping up an LLVM backend for the 360 seems like a bit much work. Using Clang's rewriter requires no real low-level maintenance, just creating and maintaining a C library for support functions emitted by the compiler (e.g. objc_msgSend). >> > > The clang rewriter is not the same than LLVM C backend. AFAIK, clang rewriter don't use llvm at all (as it does not perform codegen). It is just a source to source conversion. > I don't know how it work yet, but if it is design to output code for the NeXT Runtime, you may have to tweak it to output code compatible with your runtim. > >> It seems to create a backend for LLVM targeting the 360 I wouldn't need to create something that outputs XEX's anyway. My custom backend would effectively create object files that the 360's linker would have to be able to recognize. This would mean not only outputting all the correct ABI conforming code but the correct PDB debugging information as well. It seems much less, and easier, work to implement the support functions and run it through the standard xbox compiler as the ABI and debugging information are taken care of. >> >> On May 26, 2010, at 8:08 PM, Sherief Farouk wrote: >> >>> I'm slightly confused here, just to be clear: you're planning to go ObjC -> LLVM (via Clang or whatever) -> C, then use the 360 SDK compiler to build that, right? If that's the case, I think it'd be a better option than to use LLVM to directly generate XEXs, and you won't give the TCR guys fits (I checked the BAS TCRs, none of them say you can't do that, but the platform has some requirements regarding binary code that I doubt you'll get right without a lot of effort). If that is the pipeline you had in mind, have you attempted to run a Hello World app yet? Ran into any errors? >>> >>> - Sherief >>> >>> On May 26, 2010, at 8:20 PM, kdubb wrote: >>> >>>> We are looking at using Objective-C/C++ in a new game engine. Objective C's duality of being both very dynamic and very "C" gives us exactly what we need to make the SDK and engineering of games simpler. >>>> >>>> This means that we will need a way to compile it on all platforms our games will target. Currently the major platforms we are concerned with include... PC, Mac, XBox 360, PS3, iPhone. Now the PC, Mac, iPhone and PS3 are fairly simple. If we build our own OpenStep libraries we can simply use LLVM to compile directly to these platforms; the PS3 although proprietary uses GCC as a C/C++ compiler so I am assuming Objective-C can be used fairly simply. This leaves us with the XBox 360. >>>> >>>> The 360 is a special chip (PowerPC based) with, as far as I have researched, a special ABI (Windows derivative). I haven't the faintest clue of whether code from the LLVM PPC backend would even work on the 360, much less interoperate with the system libraries. So my formulated solution has become this: use an LLVM backend to output C code and then compile that code with using MS's XBox 360 compiler. I believe I have read that LLVM has a C backend already but I don't know how to select it. >>>> >>>> If I can get a proof of concept showing Objective-C code running on the 360 we are off to the races. Any help is appreciated just not sure if all the pieces/parts exist and/or what I am missing. So... is this feasible? If so... how do I get LLVM to output C code? >>>> >>>> Thanks, >>>> Kevin >>>> > > -- Jean-Daniel > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100527/eb5b2e73/attachment.html>
Seemingly Similar Threads
- [LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
- [LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
- [LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
- [LLVMdev] Using LLVM to compile Objective-C on an Xbox 360
- [LLVMdev] Using LLVM to compile Objective-C on an Xbox 360