Сообщения

Сообщения за июнь, 2024

Project Stage 3

 Introduction My experiences working on the final assignment for my Software Portability and Optimization course are detailed in this post. Adding diagnostic output functionality to the Gnu Compiler Collection (GCC) was the project's main objective. Implementing a diagnostic output capability that could be enabled with particular command-line parameters was my given task. This post describes the difficulties I encountered, how I worked with the current codebase to merge my improvements, and my thoughts on the project. Relevant Links Class repo My branch in the class repo Pull My fork of the class repo Integration I explained how I implemented the diagnostic output feature in the previous post. In order to integrate this feature, it was essential to create a new test dump pass for diagnostic output and update the relevant GCC files.  To achieve this, I made the following changes: Created  test-dump-pass.cc : #include "config.h" #include "system.h" #include "...

Project Stage 2

Firstly I created a custom pass code # include "config.h" # include "system.h" # include "coretypes.h" # include "backend.h" # include "tree-pass.h" # include "gimple.h" namespace { const pass_data pass_data_afmv_diagnostics = { GIMPLE_PASS, "afmv_diag" , OPTGROUP_NONE, TV_NONE, 0 , 0 , 0 , 0 , 0 }; class pass_afmv_diagnostics : public gimple_opt_pass { public : pass_afmv_diagnostics (gcc::context *ctxt) : gimple_opt_pass (pass_data_afmv_diagnostics, ctxt) {} bool gate (function*) final override { return true ; } unsigned int execute (function*) final override { fprintf (stderr, "AFMV Diagnostics: Hello, World!\n" ); return 0 ; } }; } gimple_opt_pass* make_pass_afmv_diagnostics (gc...

Project Stage 1

Изображение
Project Stage 1  Introduction to Configuring and Building GCC for AArch64 Setting up a local installation of GCC is the first step before delving into the finer points of the GCC codebase. The official installation instructions can be found here, but I've included a condensed version of the steps below. Copying the Source Code Clone the GCC source code repository in order to get started. Using an open terminal, type the following command: git  clone  git://gcc.gnu.org/git/gcc.git Setting Up the Build Directory It's important to create separate directories for different builds to maintain a clean and organized workflow. Execute the following commands to create and navigate to your build directory: mkdir ./gcc-build-001 cd ./gcc-build-001 Configuring the Local Installation In your new build directory, configure the build process by specifying a custom installation path. Replace  /path/to/install/gcc  with your desired installation location: ~/gcc/configure --pre...

Lab 3

  Lab 3 Getting Started: Unpacking the Examples To begin, I unpacked the provided example files on the SPO600 servers: cd ~ tar xvf /public/spo600-assembler-lab-examples.tgz This produced the following directory structure: spo600 └── examples └── hello ├── assembler │ ├── aarch64 │ │ ├── hello.s │ │ └── Makefile │ ├── Makefile │ └── x86_64 │ ├── hello-gas.s │ ├── hello-nasm.s │ └── Makefile └── c ├── hello2.c ├── hello3.c ├── hello.c └── Makefile I first built and ran the C versions of the "Hello World" program: cd ~/spo600/examples/hello/c make ./hello ./hello2 ./hello3 Next, I used  objdump  to disassemble the binaries and inspect the  <main>  section: objdump -d hello objdump -d hello2 objdump -d hello3 I navigated to the x86_64 directory to review and build the assembly language programs: ...