Skip to content

Commit

Permalink
scripts: Add dag grep
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcxzyw committed Jun 30, 2024
1 parent 3896c55 commit e562e7e
Show file tree
Hide file tree
Showing 7 changed files with 575 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BasedOnStyle: LLVM
IncludeCategories:
- Regex: "llvm/"
Priority: 1
- Regex: ".*"
Priority: 2
39 changes: 39 additions & 0 deletions .github/workflows/dag-grep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: DAG grep

on:
issues:
types: labeled

jobs:
build:
if: github.event.label.name == 'grep'
runs-on: self-hosted

permissions:
issues: write
contents: write

steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git -C llvm/llvm-project checkout .
git -C llvm/llvm-project clean -fdx
- name: Get Pattern IR
run: |
echo "${{ github.event.issue.body }}" | sed -n '/^```/,/^```/ p' | sed '/^```/ d' > ${{ github.workspace }}/test.ll
- name: Run LLVM DAG Grep
run: ${{ github.workspace }}/scripts/run_dag_grep.sh

- name: Report
uses: thollander/actions-comment-pull-request@v2
with:
filePath: scripts/grep.md
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ CHANGELOGS
patch.diff
*.bench_tmp.ll
.vscode
build
.cache
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.20)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

project(LLVMTools)

find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
include(AddLLVM)

include_directories(${LLVM_INCLUDE_DIRS})
set(LLVM_LINK_COMPONENTS core support irreader irprinter analysis)
add_llvm_executable(daggrep daggrep.cpp)
Loading

0 comments on commit e562e7e

Please sign in to comment.