You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
projects
resources
runtimes
scripts
test
tools
unittests
utils
FileCheck
KillTheDoctor
LLVMVisualizers
Misc
PerfectShuffle
TableGen
Target
ARM
analyze-match-table.py
bugpoint
count
crosstool
docker
emacs
fpcmp
gdb-scripts
git
git-svn
jedit
kate
lint
lit
llvm-build
llvm-lit
not
release
sanitizers
testgen
textmate
unittest
valgrind
vim
vscode
yaml-bench
DSAclean.py
DSAextract.py
GenLibDeps.pl
GetRepositoryPath
GetSourceVersion
LLVMBuild.txt
UpdateCMakeLists.pl
abtest.py
bisect
bisect-skip-count
check-each-file
clang-parse-diagnostics-file
codegen-diff
countloc.sh
create_ladder_graph.py
extract_symbols.py
findmisopt
findoptdiff
findsym.pl
getsrcs.sh
lldbDataFormatters.py
llvm-compilers-check
llvm-gisel-cov.py
llvm-native-gxx
llvm.grm
llvmdo
llvmgrep
makellvm
prepare-code-coverage-artifact.py
schedcover.py
shuffle_fuzz.py
shuffle_select_fuzz_tester.py
sort_includes.py
update_llc_test_checks.py
update_mir_test_checks.py
update_test_checks.py
wciia.py
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
version.txt.in
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
62 lines
2.1 KiB
Python
62 lines
2.1 KiB
Python
![]() |
#!/usr/bin/env python
|
||
|
|
||
|
def analyze_match_table(path):
|
||
|
# Extract the instruction table.
|
||
|
data = open(path).read()
|
||
|
start = data.index("static const MatchEntry MatchTable")
|
||
|
end = data.index("\n};\n", start)
|
||
|
lines = data[start:end].split("\n")[1:]
|
||
|
|
||
|
# Parse the instructions.
|
||
|
insns = []
|
||
|
for ln in lines:
|
||
|
ln = ln.split("{", 1)[1]
|
||
|
ln = ln.rsplit("}", 1)[0]
|
||
|
a,bc = ln.split("{", 1)
|
||
|
b,c = bc.split("}", 1)
|
||
|
code, string, converter, _ = [s.strip()
|
||
|
for s in a.split(",")]
|
||
|
items = [s.strip() for s in b.split(",")]
|
||
|
_,features = [s.strip() for s in c.split(",")]
|
||
|
assert string[0] == string[-1] == '"'
|
||
|
string = string[1:-1]
|
||
|
insns.append((code,string,converter,items,features))
|
||
|
|
||
|
# For every mnemonic, compute whether or not it can have a carry setting
|
||
|
# operand and whether or not it can have a predication code.
|
||
|
mnemonic_flags = {}
|
||
|
for insn in insns:
|
||
|
mnemonic = insn[1]
|
||
|
items = insn[3]
|
||
|
flags = mnemonic_flags[mnemonic] = mnemonic_flags.get(mnemonic, set())
|
||
|
flags.update(items)
|
||
|
|
||
|
mnemonics = set(mnemonic_flags)
|
||
|
ccout_mnemonics = set(m for m in mnemonics
|
||
|
if 'MCK_CCOut' in mnemonic_flags[m])
|
||
|
condcode_mnemonics = set(m for m in mnemonics
|
||
|
if 'MCK_CondCode' in mnemonic_flags[m])
|
||
|
noncondcode_mnemonics = mnemonics - condcode_mnemonics
|
||
|
print ' || '.join('Mnemonic == "%s"' % m
|
||
|
for m in ccout_mnemonics)
|
||
|
print ' || '.join('Mnemonic == "%s"' % m
|
||
|
for m in noncondcode_mnemonics)
|
||
|
|
||
|
def main():
|
||
|
import sys
|
||
|
if len(sys.argv) == 1:
|
||
|
import os
|
||
|
from lit.Util import capture
|
||
|
llvm_obj_root = capture(["llvm-config", "--obj-root"])
|
||
|
file = os.path.join(llvm_obj_root,
|
||
|
"lib/Target/ARM/ARMGenAsmMatcher.inc")
|
||
|
elif len(sys.argv) == 2:
|
||
|
file = sys.argv[1]
|
||
|
else:
|
||
|
raise NotImplementedError
|
||
|
|
||
|
analyze_match_table(file)
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|