[LLVMdev] Would DosBox benefit from LLVM JIT? (original) (raw)
Jacek Wielemborek d33tah at gmail.com
Wed Jul 22 06:03:27 PDT 2015
- Previous message: [LLVMdev] Would DosBox benefit from LLVM JIT?
- Next message: [LLVMdev] Would DosBox benefit from LLVM JIT?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
(First of all, I'd like to point out that I am a newbie in this topic and this is more of a "would it work?" kind of question. I basically just came up with a difficult problem and decided to research on it.)
I recently tried to run Elder Scrolls: Daggerfall on an ARM netbook Toshiba AC100 and failed even after turning on the latest patches for "dynamic recompilation". I took a look at the code and here's what I found:
https://github.com/wjp/dosbox/blob/idados/src/cpu/core_dynrec/decoder.h#L34
The relevant macros and functions are defined there:
https://github.com/wjp/dosbox/blob/idados/src/cpu/core_dynrec/risc_armv4le-o3.h
So basically, it looks like there's code that translates instructions from x86 to a few other platforms in chunks of 32 opcodes. Since this code was too slow to me, I asked myself the question "how could it speed up?" and assumed that perhaps LLVM could optimize it on the fly. So, here's the question - would it be feasible given the assumptions above? What I am thinking about is a system that would:
- Generate LLVM IR code instead of native calls and JIT them on the fly,
- Apply optimizations that I know from Clang.
I saw this example on pastebin [1] and generating functions on the fly looks rather straightforward, but I am not sure if it would be as easy if I wanted to translate machine code from one platform to another. Does LLVM have or integrate with any libraries that would make this practical? What would be the main challenges? Keep in mind that I would welcome even a partial answer.
Cheers, d33tah
[1] http://pastebin.com/f2NSGZGR
-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150722/d07751a2/attachment.sig>
- Previous message: [LLVMdev] Would DosBox benefit from LLVM JIT?
- Next message: [LLVMdev] Would DosBox benefit from LLVM JIT?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]