Skip to content

Instantly share code, notes, and snippets.

View gopi487krishna's full-sized avatar
🐧

Gopi Krishna Menon gopi487krishna

🐧
View GitHub Profile
@gopi487krishna
gopi487krishna / .Adding-Attributes-to-LLVM.md
Created September 28, 2022 13:21 — forked from colematt/.Adding-Attributes-to-LLVM.md
[Adding Attributes to LLVM] #llvm

Introduction

This post describes how to add a custom attribute to LLVM and Clang. Why would you want to do such a thing?

  • You have semantic information of which the front-end is aware, but the back-end discards in the Intermediate Representation (IR), and an existing attribute can't be used to retain this information. Adding the attribute using the front-end analysis preserves the information into the back-end generated IR.
  • You've considered using the GCC/LLVM annotate attribute to hold arbitrary strings, but you also need to add a parameter (or more!) to that annotation.

The Clang Internals Manual discusses how to do this, but not with the detail you might like to see. Its description is high-level, and only lists one file that needs to be modified. Tracking down all of the other files that must be changed is left as a frustrating exercise to the reader.

Conventions used i

@gopi487krishna
gopi487krishna / Boost Writeup.md
Last active December 14, 2020 14:14
Summary of the Work Done during GSOC period

FITS ( Flexible Image Transport System ) is an open standard defining a digital file format that serves as the de facto standard for storage, transmission, and processing of astronomical data. It provides support for storing images, multidimensional data in the form of tables.

During the GSoC period, my task was to complete the development of the existing FITS parser. That involved improvising the current FITS parser and developing an external API for communicating with the FITS module.

For a better understanding of the FITS module, the first few weeks( during the community bonding period) were spent in writing Unit tests and completing the documentation for the existing codebase. It helped me in understanding the idealogy and design of the previous fits codebase/module.

During the second phase, our primary concern was to complete the reading part of the FITS module. We replaced the existing code of the FITS module ( HDU, header, card parsing) with a policy-based design

@gopi487krishna
gopi487krishna / gsoc20.md
Last active December 29, 2021 06:17
GSOC 2020 Final Report

FITS Module

FITS or Flexible Image Transport System is an open standard defining a digital format for storage, transmission, and retrieval of data. FITS was developed by IAU in 1981 to transport different kinds of astronomical data in a unified manner. It is the most commonly used digital file format in astronomy and allows the users to store various kinds of data such as images ( example 2D image ) or tables.

More information about FITS standard can be found at :

FITS Standard

The Origin and Purpose of FITS

@gopi487krishna
gopi487krishna / task4.cpp
Last active May 18, 2020 12:43
Implement is_convertible in C++
/**
Task 4 : This is not an easy task and actually is a little complicated ( So it is going to be enjoyable ofcourse :) )
* This task is going to check your knowledge on Overloading rules in C++, and concept of Template Meta Programming/ Compile Time
Programming
* The entire solution must strictly be compile time.
Your task is to define a type-trait ( see task 2 for an introduction to type trait ) called "is_convertible" which checks
whether the value/object of one type is convertible to other or not.
@gopi487krishna
gopi487krishna / task3.cpp
Created May 16, 2020 06:30
Convert Endianess associated with a number ( To Little Endian)
/*
Task 3 :
This task is pretty simple guys . You are required to change the byte ordering of a number i.e you
have to convert the number to little-endian order . ( Read below for an example )
Your task is to define the function cnv_to_littleendian such that it converts the byte ordering of the specified argument
and returns the number in little-endian format
Example ( Hexadecimal input,output )
/**
This is a pretty easy task.
Define a structure ( well this is called a trait ) called is_same inside a namespace gstd that returns true if the types
passed are same and false if types are different
prerequisites
* Templates in C++
* Specialization of Templates
* Partial Specialization of Templates
@gopi487krishna
gopi487krishna / task1.cpp
Last active May 14, 2020 11:04
This program contains an error that goes undetected during runtime ( memory leak ).Your task is to find why that error occurs and write the correct version of program such that no memory leaks occur.
/*
Task1
There are three classes in this program
1. Demo : Holds a temporary string buffer inside it
2. Base : Parent class with a Demo object inside it ( Polymorphic Base of Derived )
3. Derived : Child class that derives from Base and contains a seperate object of Demo as well
This program contains an error that goes undetected during runtime ( memory leak ).Your task is to find that error and write
the correct version of program such that no memory leaks occur.
#pragma once
#include <string>
#include <sstream>
#include <boost/variant.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/type.hpp>
#include "fits_exception.hpp"
// string_view_vs_string_test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <vector>
#include <fstream>
#include <string_view>
#include <unordered_map>
#include <chrono>
#include <benchmark/benchmark.h>