Printer

Home WeChat: cstutorcs QQ: 749389476 #include “DataflowAnalysis.h” namespace dataflow{ struct Printer: public FunctionPass { static char ID; Printer() : FunctionPass(ID){} protected: * Print information about each instruction in each function. bool runOnFunction(Function &F) override{ errs()

Printer Read More »

CS 6340 Lab 0 Introduction to LLVM

Lab 0: Introduction to LLVM Spring Semester 2020 Due: 20 January, at 8:00 a.m. Eastern Time This lab involves running and extending LLVM, a popular compiler framework for a large class of programming languages, that will be used to implement all the labs in this course. You will setup the LLVM framework in the provided

CS 6340 Lab 0 Introduction to LLVM Read More »

ReachDefAnalysis

Home WeChat: cstutorcs QQ: 749389476 #include “DataflowAnalysis.h” namespace dataflow{ struct ReachDefAnalysis: public DataflowAnalysis{ static char ID; ReachDefAnalysis() : DataflowAnalysis(ID){} protected: * Implement your analysis in this function. Store your results in DataflowAnalysis::inMap and * DataflowAnalysis:outMap. void doAnalysis(Function &F) override{ virtual std::string getAnalysisName() override{ return “ReachDef”; char ReachDefAnalysis::ID = 1; static RegisterPass X(“ReachDef”, “Reach Definition Analysis”,

ReachDefAnalysis Read More »

Utils

Home WeChat: cstutorcs QQ: 749389476 #include “Utils.h” #include “llvm/IR/CFG.h” const char *WhiteSpaces = ” \t\n\r”; std::string toString(Value *I) { std::string Str; raw_string_ostream SS(Str); I->print(SS); return SS.str(); std::vector getPredecessors(Instruction *I) { std::vector Ret; BasicBlock *BB = I->getParent(); for (BasicBlock::reverse_iterator It = BB->rbegin(), E = BB->rend(); It != E; if (&(*It) == I) { if (It ==

Utils Read More »

Extractor

Home WeChat: cstutorcs QQ: 749389476 #include “Extractor.h” #include “llvm/IR/Instruction.h” void Extractor::initialize(AnalysisMode Mode) { Solver->register_relation(Kill); Solver->register_relation(Gen); Solver->register_relation(Next); Solver->register_relation(In); Solver->register_relation(Out); /* Variables for Rules * You may reuse X, Y, Z in all your rules expressions further down * You can also define more variables like these if you need * These variables are bitvectors of length

Extractor Read More »

calc

Home WeChat: cstutorcs QQ: 749389476 # include int main() { char operator; int firstNumber,secondNumber; printf(“Enter an operator (+, -, *, /): “); scanf(” %c”, &operator); printf(“Enter two operands: “); scanf(“%d %d”, &firstNumber, &secondNumber); switch (operator) { printf(“%d + %d = %d\n”,firstNumber, secondNumber, firstNumber + secondNumber); printf(“%d – %d = %d\n”,firstNumber, secondNumber, firstNumber – secondNumber); printf(“%d

calc Read More »

CS 6340 Software Analysis

Home WeChat: cstutorcs QQ: 749389476 * Copyright © 2021 Georgia Institute of Technology (Georgia Tech). All Rights Reserved. * Template code for CS 6340 Software Analysis * Instructors: Mayur Naik and Chris Poch * Head TAs: Kelly Parks and Joel Cooper * Georgia Tech asserts copyright ownership of this template and all derivative * works,

CS 6340 Software Analysis Read More »

Instrument

Home WeChat: cstutorcs QQ: 749389476 #include “Instrument.h” using namespace llvm; namespace instrument { static const char *SanitizerFunctionName = “__dbz_sanitizer__”; static const char *CoverageFunctionName = “__coverage__”; * Implement divide-by-zero sanitizer. void instrumentSanitizer(Module *M, Function &F, Instruction &I) { /* Add your code here */ int divisor = 0; int line = 0; int column = 0;

Instrument Read More »