Tuesday, October 5, 2010

Code Generation for x86-64

Currently Open Watcom officially provides code generators for two architectures: 16-bit and 32-bit x86 systems. Although the 16-bit x86 architecture is old, there are people still using it. Open Watcom is one of the few actively developed compiler suites that supports it. We consider this a feature.

However, the world is moving forward and many systems in use today are now 64-bit systems using the x86-64 architecture. These systems can normally run 32-bit x86 programs without any problems so such programs generated by Open Watcom continue to work on them. In fact, the Open Watcom tools themselves, all compiled with Open Watcom, run fine on my 64-bit Windows 7 system. However, many people have asked what plans we have for supporting true 64-bit code generation.

The short answer is, "We don't have any plans." It's not because we think it's a bad idea to support x86-64. On the contrary adding such support would be a wonderful addition to Open Watcom. The problem is a lack of developer resources. Adding support for a new architecture is far from trivial. It requires a new (or updated) code generator, of course, but also support in the debugger, the assembler, and various other tools. Right now the active contributors to Open Watcom all have other projects that consume their limited available time.

Interestingly the Open Watcom project does have a 64-bit code generator for the Alpha architecture. In fact a fairly functional set of Open Watcom tools can be compiled for the Alpha version of Windows NT. At least that was true at one point in time. The Alpha support was never officially released, but it shows that there is a history of 64-bit support, in some form, in Open Watcom.

One interesting approach for adding x86-64 support to Open Watcom might be to connect the Open Watcom front end to LLVM. I blogged about this last year. Doing that would be a major piece of work as well, but it might have much greater long term pay off than adding support for just a single new target. Of course it's all just talk until someone comes along who takes concrete steps toward implementing something.

0 comments: