Cosmetic fixes.
[matthijs/projects/internship.git] / Report / Main / Future.tex
1 \chapter{Future work}
2 \label{FutureWork}
3 This chapter will describe outstanding tasks and issues.
4
5 \section{Verifiers}
6 Currently, when faulty MontiumC is written, this will be detected very late in
7 the process (usually only when the backend finds something it doesn't like).
8 This means that it is quite hard to determine what is wrong in the input
9 exactly, since the backend has only limited information about where code comes
10 from.
11
12 To greatly improve this situation, verifiers should be added to the frontend.
13 These verifiers should verify the input and output code against
14 the specifications. Apart from improving user feedback, this will also greatly
15 help to fine tune the specifications and find bugs in the frontend.
16
17 \section{Debug info preservation}
18 \label{PreserveDebug}
19 Currently, transformation passes are mostly ignorant about debugging info, they
20 treat it as ordinary code. Debugging info is added to LLVM code by means
21 of special function calls. Transformations by default assume that an unknown
22 function can do anything, which means that adding debug information can prevent
23 transformations from happening. Making transformations aware of debugging info
24 will allow them to perform transformations as normal, by updating or removing
25 debugging info.
26
27 Currently, the frontend supports the emission of debugging info, which
28 the backend can use to improve it's error messages. To still perform all
29 the needed optimizations, LLVM was patched to ignore debug info in a
30 specific situation. This is not a long term solution, which requires
31 more invasive changes to LLVM.
32
33 These changes are generic for LLVM and not needed specifically for the Montium.
34 Currently, most MontiumC code seems to still work with only a little
35 change to LLVM, but especially with the new hardware, these missed
36 optimizations might become more of problem.
37
38 \section{LLVM based backend}
39 Currently, the frontend is using the LLVM framework, while the backend is
40 completely separate. While this gives maximum flexibility to the backend, it
41 might be useful to create a Montium backend within the LLVM framework. This
42 backend would benefit from being able to use existing LLVM code and passes,
43 utility code, etc. Also, this would enable the compiler to become a single
44 binary executable, instead of having a seperate executable and a Java program.
45
46 However, the main risk here is when the LLVM framework turns out to be not fully
47 suitable for the Montium backend. When nothing can be reused, the amount of code
48 needed is not any less, and if the framework poses limitations, might even be
49 more. The new hardware design might be a lot more suitable for reusing LLVM code than
50 the old Montium, however. Also, the added work of migrating to a new framework
51 and new language is also an extra cost.
52
53 Currently, doing this might or might not be a good idea. What is required first,
54 is doing a more in-depth investigation of the LLVM backend framework (which is,
55 unfortunately, the most under-documented part of LLVM) and perhaps a mockup
56 implementation.