Posts

Project Stage III: Tidy & Wrap

Image
 In this Stage III we focuse on enhanced testing rather than enabling full AFMV cloning. revised code that analyze multiple cloned functions and generating PRUNE / NOPRUNE diagnostics for each clone set. #include "config.h" #include "system.h" #include "coretypes.h" #include "backend.h" #include "tree.h" #include "gimple.h" #include "pass_manager.h" #include "context.h" #include "diagnostic-core.h" #include "tree-pass.h" #include "ssa.h" #include "tree-pretty-print.h" #include "internal-fn.h" #include "gimple-iterator.h" #include "gimple-walk.h" #include "tree-core.h" #include "basic-block.h" #include "gimple-ssa.h" #include "cgraph.h" #include "attribs.h" #include "pretty-print.h" #include "tree-inline.h" #include "intl.h" #include "dumpfile.h" #in...

Project Stage 2: Clone-Pruning Analysis Pass

Image
In this stage, we will implement a custom GCC pass that analyzes cloned functions generated through Function Multi-Versioning (FMV), determines whether they are substantially the same, and emits pruning recommendations. This is part of a broader effort toward Automatic Function Multi-Versioning (AFMV). First ,we copy and extract the SPO600 function multiversioning test archive: mkdir ~/spo600-tests cp /public/spo600-test-clone.tgz ~/spo600-tests/ cd ~/spo600-tests tar -xvzf spo600-test-clone.tgz Step1:Print detailed information about the GIMPLE statement number, statement type name (such as GIMPLE_ASSIGN), and operands. #include "config.h" #include "system.h" #include "coretypes.h" #include "tree.h" #include "tree-pass.h" #include "cgraph.h" #include "function.h" #include "basic-block.h" #include "gimple.h" #include "gimple-iterator.h" #include "cfg.h" #include "context.h...

Project Stage 1: Create a Basic GCC Pass

Image
After performed Lab4, at this stage we create a pass for the current development version of the GCC compiler which: Iterates through the code being compiled; Prints the name of every function being compiled; Prints a count of the number of basic blocks in each function; and Prints a count of the number of gimple statements in each function. Step 1: Prepare Environment I already have ~/SomeLocalDir: GCC source code directory                        ~/gcc-build-001: GCC build directory (where I ran configure).                        ~/gcc-test-001:Installation directory Step 2: Create a New GCC Pass Go to the GCC source directory: cd ~/SomeLocalDir/gcc Create my-pass.cc file: nano hxu_pass.cc #include "config.h" #include "system.h" #include "coretypes.h" #include "tree.h" #include "tree-pass.h" #include "cgraph.h" #include "function.h" #include "basic-block.h" #include "...

(Lab5) 64-Bit Assembly Language Lab

Image
In this lab, you will experiment with assembler on the x86_64 and aarch64 platforms. The code examples for this lab are available in the file  /public/spo600-assembler-lab-examples.tgz  on each of the  SPO600 Servers . Reminder:  to unpack a tar archive ( .tar ,  .tar.gz ,  .tgz , or similar file), use the  tar  command with the  x  (e x tract) and  f  (archive  f ilename) options; the  v  ( v erbose) option is also recommended:  cd ~ ; tar xvf /public/spo600-assembler-lab-examples.tgz Get Code Examples: AARCH64 we will see "spo600" folder after commands: cd ~ ; tar xvf /public/spo600-assembler-lab-examples.tgz Investigation: check Makefile: build the program and run the executable: analyze the assembly code hello.s: disassembly of the compiled hello binary, revealing its low-level machine instructions generated from hello.c: Compile hello.c to Assembly using gcc -S: cat hello.s: Create a loop.s for the loo...