Aditya Chatterjee's Blog, page 112
February 21, 2022
Instruction selection by tree-rewriting
Instruction selection involves choosing target-language instructions for each IR statement. In this article, we discuss how it can be done by a tree-rewriting process whereby tree patterns that correspond to machine instructions are used to tile a syntax tree.
Table of contents.Introduction.Tree-translation.Tiling an input tree.Pattern matching.Generalized tree matching.Summary.References.Introduction.Instruction selection is a large combinatorial task for machines rich in addressing ...
Activation trees and records
An activation tree is a tree structure that represents function calls made by a program during execution. When a function is called a new activation record is pushed to the stack and popped from the stack when the function returns.
Table of contents.Introduction.Activation trees.Activation records.Summary.References.Introduction.Language compilers that use procedures, methods, or functions as units of user-defined actions manage their run-time memory or at least part of it on the stack....
Dynamic programming for Code generation
Dynamic programming not only applies to a broad class of register machines but its application results in the generation of optimal code that runs in linear time.
Table of contents.Introduction.An example.Code generation with dynamic programming.Contiguous evaluation.The algorithm.Summary.References.Introduction.We first discuss an algorithm to generate code from a labeled expression tree that works for machines whereby computations are done in registers and instructions consist of ...
Attribute Dependence Graph and Evaluation in Semantic Analysis
In this article we discuss attribute dependency graphs and attribute evaluation during semantic analysis phase in compiler design.
Table of contents.Introduction.Dependency graphs.Attribute evaluation.Summary.References.Introduction.Given a parse tree and an Syntax Directed Definition, we draw edges among attribute instances that are associated with each node in the parse tree to denote that the value of the attribute at the head of the edge is dependent upon the value of the tail of th...
February 20, 2022
Max Pool and Avg Pool in TensorFlow
In this article, we have explored Max Pool and Avg Pool in TensorFlow in depth with Python code using the MaxPool and AvgPool ops in TensorFlow.
Table of contents:
Introduction to Max Pool and Avg PoolMax Pool in TFAverage Pooling in TFConclusionIntroduction to Max Pool and Avg PoolThe convolutional neural network is made up of three layers namely: the convolution layer , the fully connected layer and the pooling layer. In this article we will take a look at the pooling layers , more spec...
R squared and Adjusted R squared
In this article, we have explored the idea of R squared and Adjusted R squared which are frequently used in Regression Analysis to analyze data.
Table of contentsIntroductionWhat is R-squaredResidual sum of squares(RSS)Total sum of squares(TSS)Calculation R-squaredLimitations of R-squaredAdjusted R-squaredcalculation of adjusted R-squaredconclusionIntroductionHola everyone! you must have known about linear regression, if not just go through Linear regression...
Initialization of Multiset in C++
In this article, we have explored 6 different ways to initialize Multiset in C++ STL along with C++ code snippets for each approach.
Table of contents:
Introduction to Multiset in C++Initializing by inserting values one by oneInitializing like arraysInitializing from an arrayInitializing from a vectorInitializing from another multisetInitializing in descending orderIntroduction to Multiset in C++Multiset is a data structure that is used to store values. In C++'s Standard Template libra...
February 19, 2022
Machine independent Optimizations
Code written in high-level programming languages has a lot of overhead, in this article we discuss low-level techniques used to optimize this code for efficiency.
Table of contents.Introduction.Sources of optimizations.Semantic preserving optimizations.Summary.References.Introduction.Source code written in high level languages presents a lot of overhead, that is, if we translate each construct into machine code in a naive manner.
In this article, we shall see ways in which we eliminate ...
Backpatching
During the code generation phase, the compiler has to make jumps, however, the values needed for these jumps may not be known in a single pass therefore it improvises by filling up values which are replaced when the real values are known, a process known as backpatching.
Table of contents.Introduction.One pass code generation.Backpatching for boolean expressions.Flow-control statements.Break, continue and goto statements.Summary.References.Introduction.An issue with generating code f...
Types of compilers
A compiler is a program that translates source code into machine code that can be executed by a computer. In this article we explore various types of compilers.
Table of contents.Introduction.Types of compilers.Summary.References.Introduction.A compiler is a program that translates a program written in a high level language to an equivalent in machine code.
Apart from this translation a compiler is also responsible for reporting and handling of errors in the program, helping with debuggi...