Posts

PROJECT STAGE 3 - Understanding GCC Garbage Collection Test Cases in gcc.dg

Introduction Briefly introduce the significance of garbage collection in compilers and its role in ensuring memory efficiency and correctness in generated code. Overview of Test Cases Provide an overview of the test cases found in the gcc/gcc/testsuite/gcc.dg directory. Mention that these test cases cover various aspects of garbage collection, including loop optimizations, function inlining, and memory management.  Analysis of Selected Test Cases 1. loop-1.c /* Copyright (C) 2000 Free Software Foundation. Simplified from gcc/fold-const.c by Alexandre Oliva <oliva@lsd.ic.unicamp.br> */ /* { dg-do compile } */ void mul_double () { int i , j , * prod ; for ( i = 0 ; i < 4 ; i ++ ) { for ( j = 0 ; j < 4 ; j ++ ) { * prod = 0 ; } } } This test case is designed to evaluate loop optimization in GCC. It contains nested loops with a simple assignment statement inside. However, there's a critical issue: the prod p...

PROJECT STAGE 2 - DejaGNU Testing Framework

Image
Introduction to DejaGnu Testing Framework What is DejaGnu? In the world of software development, testing is a critical phase that ensures the quality and reliability of software before it reaches the end user. DejaGnu is a framework designed to facilitate the testing of software applications, providing developers with a robust environment for running tests across various platforms. Built on top of the Expect programming language, which in turn utilizes Tcl (Tool Command Language), DejaGnu offers a powerful and flexible way to automate the execution of test suites and manage test results. The Origins and Purpose of DejaGnu Developed initially by Rob Savoye and others at Cygnus Solutions, DejaGnu has grown to become a favored tool for testing by many in the open-source community. Its primary goal is to provide a consistent interface for writing and running tests, making it easier for developers to test their applications on different hosts and target platforms. This cross-platform capabi...

PROJECT STAGE 1

Getting started:  -Obtain the source code for the current development version of GCC from the Git repository. git clone git://gcc.gnu.org/git/gcc.git  cd gcc   - To build GCC outside of the source tree to keep things clean, build directory was created by following command: mkdir build Configure the build for each of two environments. It sets up the build to create a compiler. -Build GCC. Run make to start the compilation process. Task 1  Prune Cloned Functions (a) Specific, Relevant Sections of the GCC Code Base The relevant sections of the GCC codebase to prune cloned functions can be found in the files where function versioning and cloning are handled. This includes: gcc/function.c for managing functions. gcc/config/aarch64/aarch64.c for configuring AArch64. gcc/tree-vect-loop.c, or similar files, for vectorization and cloning logic. (b) Work Detail It is involved in the identification of cloned functions in AFMV, which do not offer enough improvements in performan...

64-Bit Assembly Language Lab

After successfully setting up the servers, namely  AArch64 and x86_64.   Step 1 involved reviewing AArch64 assembly code, including examining the code with objdump to understand the correspondence between source code and machine instructions Step 2 introduced a basic loop structure in AArch64 assembly, looping from 0 to 9 using register x19 as the index counter. The code provided a skeleton loop structure but did not perform any meaningful actions within the loop. .text .globl _start min = 0 /* starting value for the loop index; **note that this is a symbol (constant)**, not a variable */ max = 10 /* loop exits when the index hits this number (loop condition is i<max) */ _start: mov x19, min loop: /* ... body of the loop ... do something useful here ... */ add x19, x19, 1 cmp x19, max b.ne loop mov x0, 0 /* status -> 0 */ mov x8, 93 /* ...

Assembly language code lab 2

Image
  Lab 2 adding calculator  About:  The Adding Calculator program is designed for a computer system with specific memory locations and routines. The program prompts the user to enter two decimal numbers, performs addition, and displays the sum. Code: ; Adding Calculator ; ROM routine entry points define SCINIT $ff81 ; initialize/clear screen define CHRIN $ffcf ; input character from keyboard define CHROUT $ffd2 ; output character to screen ; zeropage variables define PRINT_PTR $10 define PRINT_PTR_H $11 define firstInput $14 define secInput $15 ; absolute variables define GETNUM_1 $0080 define GETNUM_2 $0081 define ENTER $0d ; for the ENTER key define BACKSPACE $08 ; for the BACKSPACE key ; -------------------------------------------------------- ; Main loop jsr SCINIT ; initialize/clean screen main: ; get first input' ldy #$00 jsr firstIn...

Diving into 6502 Assembly: A Beginner's Journey

Image
Embarking on the journey of learning assembly language can be both exciting and intimidating. Recently, I had the opportunity to delve into the world of 6502 assembly language, a popular instruction set used in many classic microcomputers and gaming consoles. In this blog post, I'll share my experience of running my first piece of 6502 code, understanding its functionality, and modifying it to change the output color on the screen. Starting with the Basics The 6502 processor is a marvel of its time, known for its simplicity and efficiency. To get started, my professor provided me with a snippet of 6502 assembly code. The goal of this code was to fill the screen with a specific color. Here's the code I was given: When I ran this code in a 6502 emulator, the result was a screen filled with the color yellow. This was my first tangible output from assembly code, and it was quite a thrill to see! Disassembling and Timing Analysis To truly understand what was happening under the hood...