DOC PREVIEW
CMU 15441 Computer Networking - Lab

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

IntroductionRequirementsTestsCompilersProject RequirementsNotes and Hints15-411 Compiler Design: Lab 6 - LLVMFall 2009Instructor: Frank PfenningTAs: Ruy Ley-Wild and Miguel SilvaCompilers due: 11:59pm, Sunday, December 3, 2009Term Paper due: 11:59pm, Thursday, December 10, 20091 IntroductionThe main goal of the lab is to explore advanced aspe cts of compilation. This writeup describesthe option of retargeting the compiler to generate LLVM code; other writeups detail the optionof implementing garbage collection or optimizing the generated code. The language L4 does notchange for this lab and remains the same as in Labs 4 and 5.2 RequirementsYou are required to hand in two separate items: (1) the working compiler and runtime system, and(2) a term paper describing and critically evaluating your project.3 TestsYou are not required to hand in new tests. The autograder will use a subset of the tests from theprevious labs to test your compiler.4 CompilersYour compilers should treat the language L4 as in Labs 4 and 5, including extern declarations.While we encourage you to continue to support both safe and unsafe compilation, but it complieswith the specification if the potentially unsafe implementation is simply the safe one.When generating code for the LLVM, given file name.l4, you compiler should generate: name.ll,which is in the LLVM human-readable assembly language. The driver will use LLVM commands togenerate from this the file name.s, in the x86-64 assembly language. Translation from the formerto the latter is in at least two stages, first generating an intermediate byte code file name.bc withllvm-as and then name.s by using llc (see the LLVM documentation).If you would like to apply optimizations yourself, your compiler may directly generate thename.bc file, in addition to the name.ll file, in which case the script will ignore the name.llfile. However, you must still generate it for the purpose of grading your compiler.The LLVM compilation tools can be found in1/afs/cs.cmu.edu/user/fp/courses/15411-f09/llvm/binThis directory is not in Autolab’s path, so your script need to add that or directly address theexecutable you want to run (as does the grading script).5 Project RequirementsOn the Autolab server, the hand-in and status pages for the optimization and garbage collectionprojects are separated, since different drivers will be employed.Compiler Files (due 11:59pm on Thu Dec 3)As for all labs, the files comprising the compiler itself should be collected in a directory compiler/which s hould contain a Makefile. Important: You should also update the README file and inserta roadmap to your code. This will be a helpful guide for the grader.Issuing the shell command% make l4cshould generate the appropriate files so that% bin/l4c --safe --llvm <args>% bin/l4c --unsafe --llvm <args>% bin/l4c --safe --x86_64 <args>% bin/l4c --unsafe --x86_64 <args>will run your L4 compiler in safe and unsafe modes, generating LLVM or direct x86-64 native code,respectively. For backwards compatibility, the default is --unsafe --x86_64. The driver will onlyuse the --llvm flag to autograde your code.In order for you to be able to provide a runtime system or library functions, the compiler expectsa file l4lib.c at the top-level of your compiler directory and compile and link this against yourfile when compiled in -llvm mode.You may decide just to s upport either safe or unsafe modes, which should then become thedefault. The compiler should exit with an error code if given an unsupported switch.The command% make cleanshould remove all binaries, heaps, and other generated files.Using the Subversion RepositoryThe handout files for this course can be checked out from our subversion repository via% svn checkout https://cvs.concert.cs.cmu.edu/15411-f09/<team>where <team> is the name of your team. You will find materials for this lab in the lab6llvmsubdirectory. Or, if you have checked out 15411-f09/<team> directory before, you can issue thecommand svn update in that directory.After first adding (with svn add or svn copy from a previous lab) and committing your handindirectory (with svn commit) to the repository you can hand in your tests or com piler by selecting2S3 - Autograde your code in svn repositoryfrom the Autolab server menu. It will perform% svn checkout https://cvs.concert.cs.cmu.edu/15411-f09/<team>/lab6llvm/compilerto obtain the files directories to autograde, depending on whether you are handing in your test filesor your compiler.If you are s ubmitting multiple versions, please remember to commit your changes to the repos-itory before asking the Autolab server to grade them! And please do not include an compiled filesor binaries in the repository!Term Paper (due 11:59 on Thu Dec 10)You need to describe your implemented compiler and critically evaluate it in a term paper of about10 pages. You may use more space if you need it. The recommended outline varies depending onyour project. Submit a file <team>-llvm.pdf via email to the instructor at [email protected] paper should follow this outline.1. Introduction. This should provide an overview of your implementation and briefly summarizethe results you obtained.2. Comparison. Compare compilation to LLVM, followed by native code generate with directnative code generation. How does the structure of your compiler differ? How does thegenerated code differ? If you are applying optimizations at the LLVM level, describes thoseoptimizations and their rationale.3. Analysis. Critically evaluate the results of your compiler via LLVM, which could include sizeand speed of the generated code. You might find the driver for the optimization lab lab6optto be useful for this purpuse. Also provide an evaluation of LLVM: how well did it serve yourpurpose? What might be improved?6 Notes and Hints• Apply regression testing. It is very easy to get caught up in writing a back end for a newtarget. Please make s ure your native code compiler continues to work correctly!• Read the assembly code. Just looking at the assembly code that your compiler produces willgive you useful insights into what you may nee d to change.• The intermediate form accepted by LLVM must be in SSA form. However, it is possible toallocate all variables on the stack and use a script provided with LLVM in order to convertinto SSA form. See Chapter 4.7 of the LLVM Tutorial.• The LLVM, like C, leaves the result for certain operations undefined (e.g., division by 0), soyou may need to turn them into


View Full Document

CMU 15441 Computer Networking - Lab

Documents in this Course
Lecture

Lecture

14 pages

Lecture

Lecture

19 pages

Lecture

Lecture

14 pages

Lecture

Lecture

78 pages

Lecture

Lecture

35 pages

Lecture

Lecture

4 pages

Lecture

Lecture

4 pages

Lecture

Lecture

29 pages

Lecture

Lecture

52 pages

Lecture

Lecture

40 pages

Lecture

Lecture

44 pages

Lecture

Lecture

41 pages

Lecture

Lecture

38 pages

Lecture

Lecture

40 pages

Lecture

Lecture

13 pages

Lecture

Lecture

47 pages

Lecture

Lecture

49 pages

Lecture

Lecture

7 pages

Lecture

Lecture

18 pages

Lecture

Lecture

15 pages

Lecture

Lecture

74 pages

Lecture

Lecture

35 pages

Lecture

Lecture

17 pages

lecture

lecture

13 pages

Lecture

Lecture

21 pages

Lecture

Lecture

14 pages

Lecture

Lecture

53 pages

Lecture

Lecture

52 pages

Lecture

Lecture

40 pages

Lecture

Lecture

11 pages

Lecture

Lecture

20 pages

Lecture

Lecture

39 pages

Lecture

Lecture

10 pages

Lecture

Lecture

40 pages

Lecture

Lecture

25 pages

lecture

lecture

11 pages

lecture

lecture

7 pages

Lecture

Lecture

10 pages

lecture

lecture

46 pages

lecture

lecture

7 pages

Lecture

Lecture

8 pages

lecture

lecture

55 pages

lecture

lecture

45 pages

lecture

lecture

47 pages

lecture

lecture

39 pages

lecture

lecture

33 pages

lecture

lecture

38 pages

lecture

lecture

9 pages

midterm

midterm

16 pages

Lecture

Lecture

39 pages

Lecture

Lecture

14 pages

Lecture

Lecture

46 pages

Lecture

Lecture

8 pages

Lecture

Lecture

40 pages

Lecture

Lecture

11 pages

Lecture

Lecture

41 pages

Lecture

Lecture

38 pages

Lecture

Lecture

9 pages

Lecture

Lecture

53 pages

Lecture

Lecture

51 pages

Lecture

Lecture

38 pages

Lecture

Lecture

42 pages

Lecture

Lecture

49 pages

Lecture

Lecture

63 pages

Lecture

Lecture

7 pages

Lecture

Lecture

51 pages

Lecture

Lecture

35 pages

Lecture

Lecture

29 pages

Lecture

Lecture

65 pages

Lecture

Lecture

47 pages

Lecture

Lecture

41 pages

Lecture

Lecture

41 pages

Lecture

Lecture

32 pages

Lecture

Lecture

35 pages

Lecture

Lecture

15 pages

Lecture

Lecture

52 pages

Lecture

Lecture

16 pages

Lecture

Lecture

4 pages

lecture

lecture

27 pages

lecture04

lecture04

46 pages

Lecture

Lecture

46 pages

Lecture

Lecture

13 pages

lecture

lecture

41 pages

lecture

lecture

38 pages

Lecture

Lecture

40 pages

Lecture

Lecture

25 pages

Lecture

Lecture

38 pages

lecture

lecture

11 pages

Lecture

Lecture

42 pages

Lecture

Lecture

12 pages

Lecture

Lecture

36 pages

Lecture

Lecture

46 pages

Lecture

Lecture

35 pages

Lecture

Lecture

34 pages

Lecture

Lecture

9 pages

lecture

lecture

49 pages

class03

class03

39 pages

Lecture

Lecture

8 pages

Lecture 8

Lecture 8

42 pages

Lecture

Lecture

20 pages

lecture

lecture

29 pages

Lecture

Lecture

9 pages

lecture

lecture

46 pages

Lecture

Lecture

12 pages

Lecture

Lecture

24 pages

Lecture

Lecture

41 pages

Lecture

Lecture

37 pages

lecture

lecture

59 pages

Lecture

Lecture

47 pages

Lecture

Lecture

34 pages

Lecture

Lecture

38 pages

Lecture

Lecture

28 pages

Exam

Exam

17 pages

Lecture

Lecture

21 pages

Lecture

Lecture

15 pages

Lecture

Lecture

9 pages

Project

Project

20 pages

Lecture

Lecture

40 pages

L13b_Exam

L13b_Exam

17 pages

Lecture

Lecture

48 pages

Lecture

Lecture

10 pages

Lecture

Lecture

52 pages

21-p2p

21-p2p

16 pages

lecture

lecture

77 pages

Lecture

Lecture

18 pages

Lecture

Lecture

62 pages

Lecture

Lecture

25 pages

Lecture

Lecture

24 pages

Project

Project

20 pages

Lecture

Lecture

47 pages

Lecture

Lecture

38 pages

Lecture

Lecture

35 pages

Roundup

Roundup

45 pages

Lecture

Lecture

47 pages

Lecture

Lecture

39 pages

Lecture

Lecture

13 pages

Midterm

Midterm

22 pages

Project

Project

26 pages

Lecture

Lecture

11 pages

Project

Project

27 pages

Lecture

Lecture

10 pages

Lecture

Lecture

50 pages

Lab

Lab

9 pages

Lecture

Lecture

30 pages

Lecture

Lecture

6 pages

r05-ruby

r05-ruby

27 pages

Lecture

Lecture

8 pages

Lecture

Lecture

28 pages

Lecture

Lecture

30 pages

Project

Project

13 pages

Lecture

Lecture

11 pages

Lecture

Lecture

12 pages

Lecture

Lecture

48 pages

Lecture

Lecture

55 pages

Lecture

Lecture

36 pages

Lecture

Lecture

17 pages

Load more
Download Lab
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?