博文

Project-stage 3

 This is the project stage 3. For this stage, my main task is to wrap and tidy the tasks I have done in stage 2 and manage the code to git for sharing. I have pushed the file I have created and for passes code and the modify file. They are Makefile.in, passes.def, tree-mypass.cc and tree-pass.h. You can just go my public GitHun repository and pull these files and then add the file tree-mypass.cc into the directory gcc under your GCC codebase. Then replace the files Makefile.in, passes.def, tree-pass.h under gcc directory with the files I provided for u. If you run the command to make the file again it will run successfully and create your custom GCC.  The GitHub repository: https://github.com/haolinma1/spo600-project1 After integrate my own pass in gcc and make it and install it. I got my custom GCC under the bin in my custom install folder. I locate the test-clone directory where the professor provide for me, and use command make CC=~/gcc/gcc-build/install/bin/gcc C...

Project-stage 2

 This is the stage 2 for the project. Continue on stage 1, which download the codebase and build it in my own computer. (Before professor change the requirement, I have finished the stage 1 so that I choose to build gcc in my own laptop). By the recommendation steps to finish the stage 2. First I will create a dummy pass with diagnostic dump.  By finishing the first step, I have create a file call tree-mypass.cc file which is a pass file. The code in the pass file is that #include "config.h" #include "system.h" #include "coretypes.h" #include "tree.h" #include "tree-pass.h" #include "context.h" #include "function.h" #include "dumpfile.h" namespace {     const pass_data my_pass_data = {         GIMPLE_PASS,                  "my_pass",                 OPTGROUP_NONE,                TV_NONE,        ...

Project- Stage 1

  This blog is for the  SPO600 fall project. In this project, we will work on GCC. For the stage one, we are focus on how to build the GCC including the command to build the GCC from source code, and the time to build the whole project. The GCC is a complier that can translate the C++ code into machine code. There are so many lines of code in the GCC source files. Today I am going to write a blog about my research of the GCC  We are going to talk about the builde process of GCC. Unline many small program which just have hundreds or thousands lines of codes. GCC is a huge code base, hence it require a huge amount of time to complie it. First, we need to download the codebase into our machine, we can go to the website git under gcc/gnu to find the git command for downloading. The command is  git clone git://gcc.gnu.org/git/gcc.git SomeLocalDir. After downloading the codebase we need to configure the build. First we need to create a seperate directory that the file will...

lab04

 This is the blog for SPO600 lab 4. In this lab, we mainly focus on writing the loop to output some things like the number in  6502, x86_64, aarch64 assembler. This is quite new to me since  nowadays we use modern programming language like Python, C and Javascript. But for this lab, we will go into the assembler language to see how the programs work. This lab has two part, one is class part, which means that we will be seperated into group and there was a driver to share his screen and watchers would watch him to code. The program that out group has generated in the class was: .text .globl _start min = 0                         /* starting value of the loop idx. this is a symbol */ max = 10                        /* ending value of the loop idx. this is a symbol */ _start:         mov     x19, min    ...

lab3

 This lab is for the student to understand how to use the math and string in  6502  assembly language, including displaying output, getting input from users and perform some operatiion based on the users' input. For this lab, I have designed and implement simple add calculator that accept the two input from the users. Check the input if they are number and then perform the add instruction and display the add output for the users. The code: define SCINIT   $ff81  ; Initialize/clear screen define CHRIN    $ffcf  ; Input character from keyboard define CHROUT   $ffd2  ; Output character to screen define NUM1     = $01  ; Memory location for first number define NUM2     = $02  ; Memory location for second number define RESULT   = $03  ; Memory location for result START:        JSR SCINIT      ; Clear the screen         ...

lab2

 This blog is mainly focus on the lab2 which has provided the original code of a sharp with blue color  move diagonal in the image. And in the class, we use the mob programming to finish the work. Me as the presenter who just watch and give suggestion to the driver who shared their screen and modify the orginal code. We have three tasks for this lab. The first one is selecting a starting position for X and Y with different position. This is quite easily to solve. We have just changed the line of code  LDA #$00 STA XPOS STA YPOS  to   LDA #$05         STA XPOS         LDA #$0A       STA YPOS This allow us to change the X position to 5 and Y position to 10. And the next question is selecting a X increment that is -1 or +1 and Y increment that is -1 or 1. This question is also not difficult. We can first define the x increment and y increment at top of the code like define X_INCREMENT $...

lab1

This blog is about the lab1 in spo600, in week 2, the lecture have introduced me the basic of  a ssembly language in term of using the assembly language to perform basic task like fill the page with color, optimazion of the code to improve the performance, changing the code for different color, implement different colors for different pages and get random color for thhe pixels in the pages. Now I would like to perform my work for the lab1 I have calculate the total time for the code that lab 1 has provided for me by checking the instruction set and excel, also, by looking at the bytes for each instruction, it is easy to find out the total memory for the whole program. For the initialization part which is from lda #$00 to ldy #$00, the total cycle would be 14 cycles, in the main loop, the loop has been executed 256 time for each 4 pages. So for the bne loop, if it is in the same page, the cycle will be 3 and in the other page, it will be 2. Hence the total main loop will b...