1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
Commit Graph

13 Commits

Author SHA1 Message Date
Juneyoung Lee
2f184e9475 [Utils] Add missing freeze and poison keyword highlights
This patch adds missing keyword highlights for freeze and poison

Reviewed By: MaskRay, porglezomp

Differential Revision: https://reviews.llvm.org/D104017
2021-06-14 09:21:26 +09:00
Marco Elver
b835b9cf36 [SanitizeCoverage] Add support for NoSanitizeCoverage function attribute
We really ought to support no_sanitize("coverage") in line with other
sanitizers. This came up again in discussions on the Linux-kernel
mailing lists, because we currently do workarounds using objtool to
remove coverage instrumentation. Since that support is only on x86, to
continue support coverage instrumentation on other architectures, we
must support selectively disabling coverage instrumentation via function
attributes.

Unfortunately, for SanitizeCoverage, it has not been implemented as a
sanitizer via fsanitize= and associated options in Sanitizers.def, but
rolls its own option fsanitize-coverage. This meant that we never got
"automatic" no_sanitize attribute support.

Implement no_sanitize attribute support by special-casing the string
"coverage" in the NoSanitizeAttr implementation. To keep the feature as
unintrusive to existing IR generation as possible, define a new negative
function attribute NoSanitizeCoverage to propagate the information
through to the instrumentation pass.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=49035

Reviewed By: vitalybuka, morehouse

Differential Revision: https://reviews.llvm.org/D102772
2021-05-25 12:57:14 +02:00
Andrzej Warzynski
bed7df6e8b [Utils] Add missing attributes in syntax files
Added the following attributes to all LLVM syntax files:
  * allocsize
  * cold
  * convergent
  * dereferenceable_or_null
  * hot
  * inaccessiblemem_or_argmemonly
  * inaccessiblememonly
  * inalloca
  * jumptable
  * nocallback
  * nocf_check
  * noduplicate
  * nofree
  * nomerge
  * noprofile
  * nosync
  * null_pointer_is_valid
  * optforfuzzing
  * preallocated
  * safestack
  * sanitize_hwaddress
  * sanitize_memtag
  * shadowcallstack
  * speculative_load_hardening
  * swifterror
  * syncscope
  * tailcc
  * willreturn

I generated that list by comparing:
  * Attributes.inc (generated from Attributes.td), and
  * the Vim syntax file: llvm/utils/vim/syntax/llvm.vim

My original intention was to focus on the Vim syntax file. Since other
syntax files are also out-of-date, I added these attributes (if missing)
to other files as well. Note that in the other sytnax files (i.e. for
Emacs, VScode and Kate), there will be other attributes missing too.

I've also sorted all attributes alphabetically. Otherwise it's really
hard to automate adding new attributes. And I think that it was the
original intent to keep all of them ordered alphabetically.

Differential Revision: https://reviews.llvm.org/D97627
2021-03-05 17:36:09 +00:00
Wang, Pengfei
7756ba82cf [NFC] Add x86_amx and some missed half, bfloat keywords to llvm plugin syntaxes
Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D97444
2021-03-03 10:01:10 +08:00
Nick Desaulniers
b2b1b97849 Revert "[IR] add fn attr for no_stack_protector; prevent inlining on mismatch"
This reverts commit b7926ce6d7a83cdf70c68d82bc3389c04009b841.

Going with a simpler approach.
2020-11-17 17:27:14 -08:00
Nick Desaulniers
e95a065d26 [IR] add fn attr for no_stack_protector; prevent inlining on mismatch
It's currently ambiguous in IR whether the source language explicitly
did not want a stack a stack protector (in C, via function attribute
no_stack_protector) or doesn't care for any given function.

It's common for code that manipulates the stack via inline assembly or
that has to set up its own stack canary (such as the Linux kernel) would
like to avoid stack protectors in certain functions. In this case, we've
been bitten by numerous bugs where a callee with a stack protector is
inlined into an __attribute__((__no_stack_protector__)) caller, which
generally breaks the caller's assumptions about not having a stack
protector. LTO exacerbates the issue.

While developers can avoid this by putting all no_stack_protector
functions in one translation unit together and compiling those with
-fno-stack-protector, it's generally not very ergonomic or as
ergonomic as a function attribute, and still doesn't work for LTO. See also:
https://lore.kernel.org/linux-pm/20200915172658.1432732-1-rkir@google.com/
https://lore.kernel.org/lkml/20200918201436.2932360-30-samitolvanen@google.com/T/#u

Typically, when inlining a callee into a caller, the caller will be
upgraded in its level of stack protection (see adjustCallerSSPLevel()).
By adding an explicit attribute in the IR when the function attribute is
used in the source language, we can now identify such cases and prevent
inlining.  Block inlining when the callee and caller differ in the case that one
contains `nossp` when the other has `ssp`, `sspstrong`, or `sspreq`.

Fixes pr/47479.

Reviewed By: void

Differential Revision: https://reviews.llvm.org/D87956
2020-10-23 11:55:39 -07:00
Atmn Patel
cbe95c4921 [LangRef] Define mustprogress attribute
LLVM IR currently assumes some form of forward progress. This form is
not explicitly defined anywhere, and is the cause of miscompilations
in most languages that are not C++11 or later. This implicit forward progress
guarantee can not be opted out of on a function level nor on a loop
level. Languages such as C (C11 and later), C++ (pre-C++11), and Rust
have different forward progress requirements and this needs to be
evident in the IR.

Specifically, C11 and onwards (6.8.5, Paragraph 6) states that "An
iteration statement whose controlling expression is not a constant
expression, that performs no input/output operations, does not access
volatile objects, and performs no synchronization or atomic operations
in its body, controlling expression, or (in the case of for statement)
its expression-3, may be assumed by the implementation to terminate."
C++11 and onwards does not have this assumption, and instead assumes
that every thread must make progress as defined in [intro.progress] when
it comes to scheduling.

This was initially brought up in [0] as a bug, a solution was presented
in [1] which is the current workaround, and the predecessor to this
change was [2].

After defining a notion of forward progress for IR, there are two
options to address this:
1) Set the default to assuming Forward Progress and provide an opt-out for functions and an opt-in for loops.
2) Set the default to not assuming Forward Progress and provide an opt-in for functions, and an opt-in for loops.

Option 2) has been selected because only C++11 and onwards have a
forward progress requirement and it makes sense for them to opt-into it
via the defined `mustprogress` function attribute.  The `mustprogress`
function attribute indicates that the function is required to make
forward progress as defined. This is sharply in contrast to the status
quo where this is implicitly assumed. In addition, `willreturn` implies `mustprogress`.

The background for why this definition was chosen is in [3] and for why
the option was chosen is in [4] and the corresponding thread(s). The implementation is in D85393, the
clang patch is in D86841, the LoopDeletion patch is in D86844, the
Inliner patches are in D87180 and D87262, and there will be more
incoming.

[0] https://bugs.llvm.org/show_bug.cgi?id=965#c25
[1] https://lists.llvm.org/pipermail/llvm-dev/2017-October/118558.html
[2] https://reviews.llvm.org/D65718
[3] https://lists.llvm.org/pipermail/llvm-dev/2020-September/144919.html
[4] https://lists.llvm.org/pipermail/llvm-dev/2020-September/145023.html

Reviewed By: jdoerfert, efriedma, nikic

Differential Revision: https://reviews.llvm.org/D86233
2020-10-19 13:34:27 -04:00
Anatoly Trosinenko
1adb0ef206 [Utils] Add highlighting definition for byref IR attribute
This patch assumes `byref` can be handled identically to `byval`.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D85768
2020-08-25 16:19:24 +03:00
Gui Andrade
aa6ea791fa [Utils] Add noundef attribute to vim/emacs/vscode syntax scripts
Differential Revision: https://reviews.llvm.org/D84553
2020-08-03 16:45:35 +00:00
Louis Dionne
c0d7629008 [lit] Add builtin support for flaky tests in lit
This commit adds a new keyword in lit called ALLOW_RETRIES. This keyword
takes a single integer as an argument, and it allows the test to fail that
number of times before it first succeeds.

This work attempts to make the existing test_retry_attempts more flexible
by allowing by-test customization, as well as eliminate libc++'s FLAKY_TEST
custom logic.

Differential Revision: https://reviews.llvm.org/D76288
2020-03-18 18:04:01 -04:00
Yuanfang Chen
3469e7634a Add some more vscode files
On top of existing TableGen file syntax highlighting, added
- IR syntax highlighting
- LIT test output patterMatcher
- etc.
2020-03-05 19:31:28 -08:00
Simon Tatham
87e348953e [TableGen] Update editor modes for new keywords.
Summary:
D71407 and D71474 added new keywords to the Tablegen language:
`defvar`, `if`, `then` and `else`. This commit updates the various
editor modes to highlight them appropriately.

Some of the modes also didn't include `defset`, so I've added that too
while I was there.

Reviewers: MaskRay, lebedev.ri, plotfi

Reviewed By: lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72693
2020-01-14 13:39:00 +00:00
Puyan Lotfi
e8dbea338b Adding VSCode syntax colorizer to utils (generated from textmate colorizer).
--This line, and those below, will be igored--

A    utils/vscode
A    utils/vscode/README
A    utils/vscode/tablegen
A    utils/vscode/tablegen/.vscode
A    utils/vscode/tablegen/.vscode/launch.json
A    utils/vscode/tablegen/CHANGELOG.md
A    utils/vscode/tablegen/README.md
A    utils/vscode/tablegen/language-configuration.json
A    utils/vscode/tablegen/package.json
A    utils/vscode/tablegen/syntaxes
A    utils/vscode/tablegen/syntaxes/TableGen.tmLanguage
A    utils/vscode/tablegen/vsc-extension-quickstart.md

llvm-svn: 302553
2017-05-09 17:13:37 +00:00