Posts

Showing posts from March, 2025

SPO600 Project Stage 2 (Pt.1) - GCC pass locating clone function

Image
In project stage 1, I created a GCC pass in both x86-64 server and AARCH64 server to print the functions' name and counting number of block. Now, I would like to revise the pass again and increase it's functionality. Step 1. Modify the pass First, I would like to detect if the function is a clone. When a clone is detected, loop will be broken. Meanwhile, just ignore the count of statement and blocks first. They will be useful for later part. revised code: /* Test Pass Jeff Yau, Seneca Polytechnic College Student ID :142466234 Modelled on tree-nrv.cc and tree-ctyler.cc by Chris Tyler, Seneca Polytechnic College, 2024-11 This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even th...

SPO600 Project Stage 1 (Pt.2) - Revise the GCC Pass

Image
In part 1 , I created a GCC pass in x86-64 server to print the functions' name. Now, I would like to revise the pass and increase it's functionality. Revised GCC pass code: /* Test Pass Jeff Yau, Seneca Polytechnic College Modelled on tree-nrv.cc and tree-ctyler.cc by Chris Tyler, Seneca Polytechnic College, 2024-11 This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ //#define INCLUDE_MEMORY #...

SPO600 Lab5 64-Bit Assembly Language Lab Pt.2 ---x86_64 part

Image
In the part 2 of this Lab , I am going to experiment with assembler on the x86_64 platforms, similar to the Lab part 1. Task 1 Observe the difference between source code and the object file of the x86 assembly language  Source code (gas / AT&T ): Source code (nasm / Intel): object file (gas):  Task 2 -- modify a loop code in the x86 system to print loop for 6 times. Before that, I want to modifty the Makefile so that it can make file for the loop-gas.s Revised Makefile: code: BINARIES=hello-nasm hello-gas loop-gas all: ${BINARIES} AS_ARGS=-g hello-nasm: hello-nasm.s nasm -g -o hello-nasm.o -f elf64 hello-nasm.s ld -o hello-nasm hello-nasm.o hello-gas: hello-gas.s as ${AS_ARGS} -o hello-gas.o hello-gas.s ld -o hello-gas hello-gas.o loop-gas: loop-gas.s as ${AS_ARGS} -...

SPO600 Project Stage 1 (Pt.1) - Create a GCC Pass

Image
Create a GCC Pass I would like to create a GCC Pass. I expect the pass will be used to analyze the GIMPLE files. Step 1. Get to the gcc subdirectory I go to the directory of my gcc source code. Then, I get to the gcc subdirectory inside the sourcecode of gcc. Step 2. Create a very simple pass I create a Pass file modeled on the pass_nrv. I just hope the pass works first. So, the pass is as simple as possible. code: /* Test Pass Jeff Yau, Seneca Polytechnic College Modelled on tree-nrv.cc and tree-ctyler.cc by Chris Tyler, Seneca Polytechnic College, 2024-11 This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Se...