1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
Commit Graph

147 Commits

Author SHA1 Message Date
Tom Stellard
71c9962122 [Utils][vim] Highlight 'ptr' type
Differential Revision: https://reviews.llvm.org/D102460
2021-06-09 21:39:51 -07: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
Senran Zhang
9e6695ba98 [Utils][vim] Highlight CHECK-EMPTY: & CHECK-COUNT: directives
Reviewed By: porglezomp

Differential Revision: https://reviews.llvm.org/D101135
2021-05-18 23:42:23 -04:00
Tim Northover
fc5daa6083 IR/AArch64/X86: add "swifttailcc" calling convention.
Swift's new concurrency features are going to require guaranteed tail calls so
that they don't consume excessive amounts of stack space. This would normally
mean "tailcc", but there are also Swift-specific ABI desires that don't
naturally go along with "tailcc" so this adds another calling convention that's
the combination of "swiftcc" and "tailcc".

Support is added for AArch64 and X86 for now.
2021-05-17 10:48:34 +01:00
Fraser Cormack
8bce4ebee8 [Utils][vim] Highlight 'vscale' constant
Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D101466
2021-04-29 08:53:30 +01:00
Senran Zhang
d628808ad9 [Utils][vim] Highlight poison keyword
Reviewed By: awarzynski, MaskRay

Differential Revision: https://reviews.llvm.org/D98927
2021-03-19 19:09:11 -07: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
Cassie Jones
f638cb4edc [vim] Highlight most common MIR syntax not in LLVM IR
This adds highlighting for MIR instruction opcodes, physical registers,
and MIR types.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D95553
2021-02-17 02:39:03 -05:00
Cassie Jones
7f4b320ea8 [vim] Add initial syntax definition for .mir files
This initial definition handles the yaml container and the embedding of
the inner IRs. As a stopgap, this reuses the LLVM IR syntax highlighting
for the MIR function bodies--even though it's not technically correct,
it produces decent highlighting for a first pass.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D95552
2021-02-17 02:38:16 -05: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
Cullen Rhodes
87b0a8da93 vim: add bfloat keyword
Highlight the `bfloat` type introduced in D78190.
2020-06-18 17:06:06 +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
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
Reid Kleckner
a973c0bd85 [X86] Add new calling convention that guarantees tail call optimization
When the target option GuaranteedTailCallOpt is specified, calls with
the fastcc calling convention will be transformed into tail calls if
they are in tail position. This diff adds a new calling convention,
tailcc, currently supported only on X86, which behaves the same way as
fastcc, except that the GuaranteedTailCallOpt flag does not need to
enabled in order to enable tail call optimization.

Patch by Dwight Guth <dwight.guth@runtimeverification.com>!

Reviewed By: lebedev.ri, paquette, rnk

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

llvm-svn: 373976
2019-10-07 22:28:58 +00:00
Sven van Haastregt
5474afbc05 vim: add immarg keyword
The `immarg` attribute was added in r355981.

llvm-svn: 370443
2019-08-30 08:52:55 +00:00
Sam Clegg
071e8b989c Line wrap README file
llvm-svn: 356204
2019-03-14 21:09:14 +00:00
Saleem Abdulrasool
24682f017f vim: swiftself is an attribute
Highlight the `swiftself` attribute on parameters.

llvm-svn: 354934
2019-02-27 00:12:11 +00:00
Craig Topper
ea7e6b3857 Implementation of asm-goto support in LLVM
This patch accompanies the RFC posted here:
http://lists.llvm.org/pipermail/llvm-dev/2018-October/127239.html

This patch adds a new CallBr IR instruction to support asm-goto
inline assembly like gcc as used by the linux kernel. This
instruction is both a call instruction and a terminator
instruction with multiple successors. Only inline assembly
usage is supported today.

This also adds a new INLINEASM_BR opcode to SelectionDAG and
MachineIR to represent an INLINEASM block that is also
considered a terminator instruction.

There will likely be more bug fixes and optimizations to follow
this, but we felt it had reached a point where we would like to
switch to an incremental development model.

Patch by Craig Topper, Alexander Ivchenko, Mikhail Dvoretckii

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

llvm-svn: 353563
2019-02-08 20:48:56 +00:00
Matt Arsenault
d002202938 Add fneg instruction to syntax highlighting lists
llvm-svn: 346785
2018-11-13 19:50:38 +00:00
Saleem Abdulrasool
72a552dcd4 vim: rename singlethread to syncscope
SVN r307722 renamed the keyword from `singlethread` to `syncscope`.
Update the syntax file accordingly.

llvm-svn: 328211
2018-03-22 16:39:54 +00:00
Saleem Abdulrasool
19a250a7ce vim: add dso_local and dso_preemptable keywords
Support the new keywords introduced in SVN r316668.

llvm-svn: 328170
2018-03-21 23:46:09 +00:00
Mikhail Maltsev
b104cac764 [vim] Recognize more FileCheck comments
Summary:
Currently vim syntax highlighting recognizes 'CHECK:' as a special
comment, but not CHECK-DAG, CHECK-NOT and other CHECKs. This patch
adds rules for these comments.

Reviewers: chandlerc, compnerd, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, llvm-commits

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

llvm-svn: 325599
2018-02-20 17:27:44 +00:00
Andrew Kaylor
76e7a73bbb Add strictfp attribute to prevent unwanted optimizations of libm calls
Differential Revision: https://reviews.llvm.org/D34163

llvm-svn: 310885
2017-08-14 21:15:13 +00:00
Martin Storsjo
707a6e74b7 [AArch64] Extend CallingConv::X86_64_Win64 to AArch64 as well
Rename the enum value from X86_64_Win64 to plain Win64.

The symbol exposed in the textual IR is changed from 'x86_64_win64cc'
to 'win64cc', but the numeric value is kept, keeping support for
old bitcode.

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

llvm-svn: 308208
2017-07-17 20:05:19 +00:00
Craig Topper
53368afb5b vim: add 'builtin', 'nobuiltin', 'nonnull', and 'speculatable' to the keyword list.
llvm-svn: 307419
2017-07-07 18:28:45 +00:00
Saleem Abdulrasool
7641b1278e vim: add returned keyword
The `returned` keyword was added in SVN r179925.  Update the vim syntax
rules.

llvm-svn: 294808
2017-02-10 23:57:11 +00:00
Dan Gohman
754743ea64 [Utils] Update comment in vimrc
Fixed wrong paths in comments for *.vim files.

Patch By: Bruno Rosa (brunoalr)

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

llvm-svn: 293693
2017-01-31 21:33:21 +00:00
Saleem Abdulrasool
df691a0c97 vim: special case the CHECK prefix
A large number of tests in the LLVM tree use the default (CHECK) prefix
to indicate checked expressions via FileCheck.  Highlight it as a
special comment.  Although this wont get all the instances of the
checked patters, it is strictly better than the current state.

llvm-svn: 285927
2016-11-03 15:56:06 +00:00
Saleem Abdulrasool
6db78758e9 vim: add norecurse attribute
Add missing attribute to the keyword set.

llvm-svn: 284270
2016-10-14 19:48:34 +00:00
Saleem Abdulrasool
3fe8f442d0 vim: add comdat keyword
The attribute may be applied to a function.  Highlight it as a keyword.

llvm-svn: 284269
2016-10-14 19:48:31 +00:00
David Majnemer
61a7d953e4 [vim] Add more attributes to llvm.vim
llvm-svn: 278415
2016-08-11 21:14:05 +00:00
David Majnemer
1075cbd4a4 [vim] Update the llvm.vim syntax file
We never updated this file to contain the WinEH instructions.
Also, add the dereferenceable attribute.

llvm-svn: 278146
2016-08-09 18:34:19 +00:00
Saleem Abdulrasool
a7b7b3ed35 vim: separate the keywords into one per line
This achieves the same result as previously by using line wrapping.  This allows
us to have one keyword per line which makes adding a new keyword significantly
easier, especially if they are inserted in a lexicographical sort order as you
no longer need to reflow the content around it.

This only does the keywords as that is the group which changes more often.

llvm-svn: 275248
2016-07-13 03:47:58 +00:00
Saleem Abdulrasool
ea53e31958 vim: add local_unnamed_addr keyword
The `local_unnamed_addr` was introduced in SVN r272709.  Update the syntax
highlighting rules.

llvm-svn: 275245
2016-07-13 03:36:05 +00:00
Saleem Abdulrasool
7e3b0da900 vim: add swiftcc keyword
Update the syntax highlighting for SVN r265480.

llvm-svn: 266705
2016-04-19 02:04:01 +00:00
Saleem Abdulrasool
55896cb4eb vim: add missing keyword
`source_filename` was introduced as a keyword in SVN r264884, but the syntax
file was not updated.

llvm-svn: 265572
2016-04-06 17:42:16 +00:00
Manuel Jacob
82359bb5a3 [vim] Add token type to Vim syntax file.
llvm-svn: 256512
2015-12-28 19:51:04 +00:00
Maksim Panchenko
cb20c21c8a HHVM calling conventions.
HHVM calling convention, hhvmcc, is used by HHVM JIT for
functions in translated cache. We currently support LLVM back end to
generate code for X86-64 and may support other architectures in the
future.

In HHVM calling convention any GP register could be used to pass and
return values, with the exception of R12 which is reserved for
thread-local area and is callee-saved. Other than R12, we always
pass RBX and RBP as args, which are our virtual machine's stack pointer
and frame pointer respectively.

When we enter translation cache via hhvmcc function, we expect
the stack to be aligned at 16 bytes, i.e. skewed by 8 bytes as opposed
to standard ABI alignment. This affects stack object alignment and stack
adjustments for function calls.

One extra calling convention, hhvm_ccc, is used to call C++ helpers from
HHVM's translation cache. It is almost identical to standard C calling
convention with an exception of first argument which is passed in RBP
(before we use RDI, RSI, etc.)

Differential Revision: http://reviews.llvm.org/D12681

llvm-svn: 248832
2015-09-29 22:09:16 +00:00
Jonathan Roelofs
905326fdb1 llvm.vim: 'musttail' is a keyword too
llvm-svn: 246798
2015-09-03 20:10:40 +00:00
Tanya Lattner
a72d000c61 Rename all references to old mailing lists to new lists.llvm.org address.
llvm-svn: 243999
2015-08-05 03:51:17 +00:00
Chandler Carruth
84f03dd114 [vim] Update the syntax to mark REQUIRES lines and not talk about
dejagnu.

I wonder if it would be useful to handle FileCheck prefixes specially?
Especially if we could get some error checking. Suggestions welcome.
Patches more welcome as I have no idea what I'm doing with vim
script....

llvm-svn: 242267
2015-07-15 01:48:40 +00:00
Chandler Carruth
45b43d58c4 [vim] Add the IR's comment prefix to the comments list. This allows vim
to intelligently wrap prose written in IR comment blocks. This has
bothered me for roughly ever, and my fellow IRC denziens convinced me to
fix it.

llvm-svn: 242266
2015-07-15 01:36:50 +00:00
Matthias Braun
981c4f348d Vim: Fix some bugs in llvm indent plugin.
llvm-svn: 236464
2015-05-04 21:41:25 +00:00
Matthias Braun
13bf28ceb8 Vim: Set filetype=python for lit configuration files.
llvm-svn: 236463
2015-05-04 21:41:23 +00:00
Matthias Braun
22e75ab682 Enhanced vim support.
This brings the utils/vim folder into a more vim-like format by moving
the syntax hightlighting files into a syntax subdirectory. It adds
some minimal settings that everyone should agree on to ftdetect/ftplugin and
features a new indentation plugin for .ll files.

llvm-svn: 235369
2015-04-21 01:35:42 +00:00