I want to write a GCC Plugin that performs a simple loop interchange on a nested for loop, so that an inner for statement is to be swapped with its outer for statement. I am making this plugin as a practice which is assigned by the supervisor of a project that I am working on. To learn how to transform loop structure, I have tried experimenting with the loop manipulation functions shown in the gcc internal manual by calling the loops in my source code with FOR_EACH_LOOP (I tried to remove some loop nodes). However any manipulation that I attempted doesn't seem to be produced in the output code. I am really new to GCC Plugin API or GCC development in overall. So is there anyone who can tell me where to start in making this loop interchange?