Coder Social home page Coder Social logo

zhaosiying12138 / klee Goto Github PK

View Code? Open in Web Editor NEW

This project forked from klee/klee

3.0 0.0 0.0 9.74 MB

Implement PDG AutoVectorization on KLEE Symbolic Execution Engine

Home Page: http://klee.github.io/

License: Other

Shell 1.07% C++ 66.88% Python 3.67% C 18.22% PHP 0.37% Emacs Lisp 0.11% HTML 0.22% CMake 3.35% LLVM 5.88% SMT 0.01% Dockerfile 0.12% NASL 0.09%

klee's Introduction

PDG AutoVectorization

A toy auto-vectoraization implementation about the application of Program Dependence Graph using LLVM by zhaosiying12138.
It can do auto-vectoraization when control flow exists since its If-Conversion algorithm can treat Control Dependence as Data Dependence.

1. File Organization

lib/Module/PDGAnalysis.cpp: an LLVM Analysis Pass to generate PDG information from LLVM IR;
lib/Module/Tarjan_SCC.cpp: an utility class to calculate SCC of PDG;
lib/Module/isl_ddg_analysis.c: an utility program to calculate Data Dependence Graph(DDG) to construct PDG, however, since I haven't integrate ISL into KLEE(我不会,斯米马赛~~), you need put this file into the ISL source code dictionary and compile, for more information please visit: https://github.com/zhaosiying12138/isl and 《零基础入门依赖环的检测》-流霞祭司曌鹓鶵;
lib/Core/PDGExecutor.cpp: modification on klee executor to executor loops of LLVM IR in a Loop-Distribution-Form automatically;
zsy_test/demo2_3.ll: the demo LLVM IR executed to test the overall algorithm;
zsy_test/demo3_3.ll: the demo LLVM IR executed to test CDG Construction algorithm only;
zsy_test/demo4.c: the demo C source code to show the principle of the PDG-AutoVec algorithm;

2. Usage

Step 1: Make a testfile (You can skip this step if you would like to use [zsy_test/demo2_3.ll] provided for you if you just want to learn the principle of PDG_AutoVec)

clang -Xclang -disable-O0-optnone -S -O0 -emit-llvm demo1.c -o demo1_1.ll  
opt -S -mem2reg demo1_1.ll -o demo1_2.ll  
opt -S -loop-simplify demo1_2.ll -o demo1_3.ll  

Step 2: Build modified KLEE

mkdir build  
cd build  
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_SOLVER_Z3=ON -DZ3_INCLUDE_DIRS=/your-z3-dir/include/ -DZ3_LIBRARIES=/your-z3-dir/lib/libz3.so -DLLVM_DIR=/your-llvm-dir/  
make -j 65535  

Step 3: Execute the LLVM IR using KLEE

build/bin/klee zsy_test/demo2_3.ll  

3. Experimental Results

1. CDG Construction


2. DDG Construction

3. PDG Construction & Cut SCC & Toposort


4. KLEE Execution Result


5. Algorithm Extension when Exit Branch exits




4. Link

《零基础入门控制依赖图构建的理论与实践》-流霞祭司曌鹓鶵
《零基础入门基于程序依赖图对带有控制流程序自动向量化的实现》-流霞祭司曌鹓鶵

5. Copyright

Copyright (c) 2023 By 流月城先进偃甲技术研究院-对伏羲外包国家重点实验室-流霞祭司曌鹓鶵 founded by 五色石炼制关键工艺天界自然科学基金(2022LYC12138). All rights reserved.

klee's People

Contributors

ccadar avatar martinnowack avatar ddunbar avatar 251 avatar jbuening avatar andreamattavelli avatar jirislaby avatar danielschemmel avatar lzaoral avatar pcc avatar kren1 avatar delcypher avatar zhaosiying12138 avatar arrowd avatar hpalikareva avatar operasfantom avatar corrodedhash avatar holycrap872 avatar antiagainst avatar willemp avatar futile avatar domainexpert avatar mic92 avatar ddcc avatar kaomoneus avatar adrianherrera avatar fwc avatar jiseongg avatar mchalupa avatar ret2libc avatar

Stargazers

Zhijie Liu avatar XChy avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.