llvm-project/llvm/utils
Nirav Dave a0003984e5 [TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true
Consider the following instruction: "inst.eq $dst, $src" where ".eq"
is an optional flag operand.  The $src and $dst operands are
registers.  If we parse the instruction "inst r0, r1", the flag is not
present and it will be marked in the "OptionalOperandsMask" variable.
After the matching is complete we call the "convertToMCInst" method.

The current implementation works only if the optional operands are at
the end of the array.  The "Operands" array looks like [token:"inst",
reg:r0, reg:r1].  The first operand that must be added to the MCInst
is the destination, the r0 register.  The "OpIdx" (in the Operands
array) for this register is 2.  However, since the flag is not present
in the Operands, the actual index for r0 should be 1.  The flag is not
present since we rely on the default value.

This patch removes the "NumDefaults" variable and replaces it with an
array (DefaultsOffset).  This array contains an index for each operand
(excluding the mnemonic).  At each index, the array contains the
number of optional operands that should be subtracted.  For the
previous example, this array looks like this: [0, 1, 1].  When we need
to access the r0 register, we compute its index as 2 -
DefaultsOffset[1] = 1.

Patch by Alexandru Guduleasa!

Reviewers: SamWot, nhaustov, niravd

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35998

llvm-svn: 309949
2017-08-03 15:40:21 +00:00
..
FileCheck [FileCheck] Don't scan past the closing CHECK-DAG for CHECK-NOT inside CHECK-DAG 2017-06-07 12:06:45 +00:00
KillTheDoctor KillTheDoctor.cpp: Appease cases on case-senstitive host, like mingw on linux. 2016-12-23 01:39:26 +00:00
LLVMVisualizers Improve natvis for llvm::SmallString so that it correctly displays only the valid portion of the string 2016-12-21 01:05:29 +00:00
Misc
PerfectShuffle
TableGen [TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true 2017-08-03 15:40:21 +00:00
Target/ARM
bugpoint
count
crosstool
docker [docker] Fix unmatched quote problem in here-document on older versions of bash 2017-07-31 15:18:57 +00:00
emacs
fpcmp
gdb-scripts Make the Twine pretty-printer work with GDB 7.11 2017-06-04 03:27:12 +00:00
git
git-svn Revert r305598, "utils: Add a git-r utility for mapping svn revisions to git revisions in the monorepo." 2017-06-19 20:43:09 +00:00
jedit
kate
lint
lit Revert "[lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs" 2017-08-02 17:16:25 +00:00
llvm-build
llvm-lit [utils] Add libc++ and libc++abi config to llvm-lit 2017-01-17 07:10:55 +00:00
not Remove unused header, NFC. 2016-12-01 19:38:48 +00:00
release test-release.sh: Fix phase2 and phase3 binary comparision 2017-07-24 19:28:30 +00:00
sanitizers Fix UBSan bots by blacklisting bits/stl_tree.h. 2017-01-13 17:30:10 +00:00
testgen
textmate
unittest Note addition of NetBSD support in googletest 2017-05-06 02:45:42 +00:00
valgrind
vim [AArch64] Extend CallingConv::X86_64_Win64 to AArch64 as well 2017-07-17 20:05:19 +00:00
vscode Adding VSCode syntax colorizer to utils (generated from textmate colorizer). 2017-05-09 17:13:37 +00:00
yaml-bench Timer: Track name and description. 2016-11-18 19:43:18 +00:00
DSAclean.py
DSAextract.py
GenLibDeps.pl
GetRepositoryPath
GetSourceVersion
LLVMBuild.txt
UpdateCMakeLists.pl
abtest.py AsmPrinter: mark the beginning and the end of a function in verbose mode 2017-05-23 21:22:16 +00:00
bisect
bisect-skip-count Fix bug in bisect-skip-count not using passed-in arguments 2017-03-04 03:23:41 +00:00
check-each-file
clang-parse-diagnostics-file
codegen-diff
countloc.sh
create_ladder_graph.py
extract_symbols.py Handle non-inlined clang::Type::getAs specializations in extract_symbols.py 2016-11-14 17:07:09 +00:00
findmisopt
findoptdiff
findsym.pl
getsrcs.sh
lldbDataFormatters.py
llvm-compilers-check
llvm-native-gxx
llvm.grm
llvmdo
llvmgrep
makellvm
prepare-code-coverage-artifact.py [utils] coverage: Add help text about the --restrict flag (NFC) 2017-02-09 19:37:18 +00:00
schedcover.py
shuffle_fuzz.py
sort_includes.py
test_debuginfo.pl
update_llc_test_checks.py Fix update_llc_test_checks.py ARM parsing 2017-07-28 23:58:24 +00:00
update_test_checks.py [utils] remove ability to generate llc check lines from update_test_checks.py 2017-06-12 17:44:30 +00:00
wciia.py