Skip to content

Commit

Permalink
get core compiling with desesc (C++17 cleanup and dromajo)
Browse files Browse the repository at this point in the history
  • Loading branch information
renau committed Oct 30, 2022
1 parent 25bbc56 commit ec8e185
Show file tree
Hide file tree
Showing 228 changed files with 67,784 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# livehd specific bazel options
build --output_filter='^//(core|pass|inou)'
#build --output_filter="^//"
build --cxxopt="-std=c++17" --cxxopt="-fexceptions" --force_pic --build_tag_filters="-fixme"
# test --cache_test_results=no

# Use Clang
build:clang --action_env=CC=clang
build:clang --action_env=CXX=clang++
#build:clang --linkopt -fuse-ld=lld

# config that enables super aggressive optimization for max performance
build:bench --copt -ffast-math
build:bench --copt -Ofast
build:bench --copt -march=native
build:bench --copt -DNDEBUG

build:bench --cxxopt -ffast-math
build:bench --cxxopt -Ofast
build:bench --cxxopt -march=native
build:bench --cxxopt -DNDEBUG

build:prof --copt -Og
build:prof --cxxopt -Og
build:prof --linkopt -Og

build:prof --copt -pg
build:prof --cxxopt -pg
build:prof --linkopt -pg

#build:prof --copt -fprofile-arcs
#build:prof --cxxopt -fprofile-arcs
#build:prof --linkopt -fprofile-arcs

#build:prof --copt -ftest-coverage
#build:prof --cxxopt -ftest-coverage
#build:prof --linkopt -ftest-coverage

test --test_tag_filters "-long1,-long2,-long3,-long4,-long5,-long6,-long7,-long8,-manual,-fixme"
coverage --test_tag_filters "-long1,-long2,-long3,-long4,-long5,-long6,-long7,-long8,-manual,-fixme"
coverage --cache_test_results=no

# Address sanitizer
build:asan --strip=never
build:asan --copt -fsanitize=address
build:asan --copt -DADDRESS_SANITIZER
#build:asan --copt -O1
build:asan --copt -g
build:asan --copt -fno-omit-frame-pointer
build:asan --cxxopt -fsanitize=address
build:asan --cxxopt -DADDRESS_SANITIZER
#build:asan --cxxopt -O1
build:asan --cxxopt -std=c++17
build:asan --cxxopt -g
build:asan --cxxopt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address

# Thread sanitizer
build:tsan --strip=never
build:tsan --copt -fsanitize=thread
build:tsan --copt -DTHREAD_SANITIZER
build:tsan --copt -DDYNAMIC_ANNOTATIONS_ENABLED=1
build:tsan --copt -DDYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1
build:tsan --copt -g
# build:tsan --copt -O1
build:tsan --copt -fno-omit-frame-pointer

build:tsan --cxxopt -fsanitize=thread
build:tsan --cxxopt -DTHREAD_SANITIZER
build:tsan --cxxopt -DDYNAMIC_ANNOTATIONS_ENABLED=1
build:tsan --cxxopt -DDYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1
build:tsan --cxxopt -g
build:tsan --cxxopt -std=c++17
# build:tsan --copt -O1
build:tsan --cxxopt -fno-omit-frame-pointer
build:tsan --linkopt -fsanitize=thread

# Undefined Behavior sanitizer
build:ubsan --strip=never
build:ubsan --copt -fsanitize=undefined
build:ubsan --copt -fno-omit-frame-pointer
build:ubsan --linkopt -fsanitize=undefined
build:ubsan --linkopt -lubsan
build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
20 changes: 20 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
BasedOnStyle: Google
ColumnLimit: '132'
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'true'
#AlignConsecutiveBitFields: 'true'
AlignConsecutiveMacros: 'true'
AlignTrailingComments: 'true'
AlignEscapedNewlines: 'true'
AlignAfterOpenBracket: 'Align'
AlignOperands: 'true'
AllowAllArgumentsOnNextLine: 'false'
BinPackArguments: 'false'
AllowShortIfStatementsOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'true'
BreakConstructorInitializers: 'BeforeComma'
BreakBeforeBinaryOperators: 'true'
BreakStringLiterals: 'true'
AccessModifierOffset: -2
...
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,19 @@
*.exe
*.out
*.app

# Common edits
pp
tags
cscope*
*NBSD*
*.swp
*.swo
*.swn

# No log files
*.log

# No bazel
bazel-*

20 changes: 20 additions & 0 deletions TODO.desesc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

desesc: Dromajo Based ESESC

-Remove most (all?) the const char *str, and use std::string or std::string_view

-Remove most mallocs (string related. any else?)

-Get code style compliant with LiveHD


=Cleanup callback

The code is based on esesc (C++ from 2000 without lambdas/std::function). Use
something closer to LiveHD tasks queue syntax.

=Deprecase the pool

Use new/delete, then valgrind can be used to detect memory leaks (no need for
in-class check for leaks)

69 changes: 69 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This file is distributed under the BSD 3-Clause License. See LICENSE for details.

workspace(name = "desesc")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")

# google benchmark
http_archive(
name = "com_google_benchmark",
sha256 = "ef0fab8058be682e382e155eeda1b22e1747fd6606e22e0c1b19f6da91e8b52d",
strip_prefix = "benchmark-69054ae50e07e9de7cb27f9e2d1d355f74605524",
urls = ["https://github.com/google/benchmark/archive/69054ae50e07e9de7cb27f9e2d1d355f74605524.zip"],
)

# google tests
http_archive(
name = "com_google_googletest",
urls = ["https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip"],
strip_prefix = "googletest-609281088cfefc76f9d0ce82e1ff6c30cc3591e5",
)

# fmt
http_archive(
name = "fmt",
build_file = "fmt.BUILD",
sha256 = "fccfc86e4aff6c33bff9a1d907b2ba2de2a5a8ab84349be4964a93f8d8c21b62",
strip_prefix = "fmt-7bdf0628b1276379886c7f6dda2cef2b3b374f0b",
urls = [
"https://github.com/fmtlib/fmt/archive/7bdf0628b1276379886c7f6dda2cef2b3b374f0b.zip",
],
)

# iassert
http_archive(
name = "iassert",
sha256 = "c6bf66a76d5a1de57c45dba137c9b51ab3b4f3a31e5de9e3c3496d7d36a128f8",
strip_prefix = "iassert-5c18eb082262532f621a23023f092f4119a44968",
urls = [
"https://github.com/masc-ucsc/iassert/archive/5c18eb082262532f621a23023f092f4119a44968.zip",
],
)

# abseil
http_archive(
name = "com_google_absl",
urls = ["https://github.com/abseil/abseil-cpp/archive/98eb410c93ad059f9bba1bf43f5bb916fc92a5ea.zip"],
strip_prefix = "abseil-cpp-98eb410c93ad059f9bba1bf43f5bb916fc92a5ea",
)

# Perfetto
http_archive(
name = "com_google_perfetto",
build_file = "perfetto.BUILD",
sha256 = "06eec38d02f99d225cdad9444102e77d9da717f8cc55f84a3b212abe94a5fc5a",
strip_prefix = "perfetto-28.0/sdk",
urls = ["https://github.com/google/perfetto/archive/refs/tags/v28.0.tar.gz"],
)

# Perfetto
http_archive(
name = "toml11",
build_file = "toml11.BUILD",
sha256 = "4124577f989d6a558229ef8f06944ca210e4cf1fe72975eaa2528f1a53f129c4",
strip_prefix = "toml11-3.7.1",
urls = [
"https://github.com/ToruNiina/toml11/archive/v3.7.1.zip",
],
)
Loading

0 comments on commit ec8e185

Please sign in to comment.