Commit Graph
47 Commits
Author SHA1 Message Date
Marc Poulhiès 8679767220 Fix parsing assembler from binary when templates are used (#3238)
When compiling to binary and with the demangling enabled, the assembler parser
was not correctly matching the "labels". The labelRe regex is tailored from
matching against the real symbol names, before any demangling. In the
binary+demangle context, we rely on objdump doing both at once, feeding our
parser with demangled names.

Make the labelRe match anything of the form:
00000000123af    <every thing here is the label>:

fixes #3235

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2022-01-07 09:07:37 +01:00
Patrick Quist b744d6ad9e Asm-parser binary bugfix (#2904)
* unittests

* extra label definition screws up logic

* fix test
2021-08-31 14:07:23 +02:00
partouf 9d382eb03e bugfix mainsource detection 2021-08-29 13:11:15 +00:00
Patrick Quist 5e5e60159a Multifile/IDE mode (#2725) 2021-08-26 21:57:07 +02:00
Matt GodboltandRabsRincon d52a1318f8 Treat data definitions in the middle of functions as "strong" (#2792)
* Treat data definitions in the middle of functions as "strong"

Things like ARM jump tables put important data inline within a function. Such
data should be treated as a "strong" reference (e.g. a root use). For example:

```
        sub     r3, r0, #65
        cmp     r3, #19
        ldrls   pc, [pc, r3, asl #2]
        b       .L7
        .word   .L8
        .word   .L7
        .word   .L6
        .word   .L7
        ....etc...
.L7: some things
.L8: some other things
```

Without this change, the `.L8` label would be dropped as unused. But it's implicitly used
by the sequence of `.word`s in the middle of the function.

Closes #2788

* Keep curly bracket style of existing if-else block

Co-authored-by: RabsRincon <ruben@rinconblanco.es>
2021-07-22 14:12:54 -05:00
Artem Belevich 115cbf3817 Add support for HIP compilation for AMD GPUs. (#2759)
* Added support for HIP compilation for AMD GPUs.

At the moment it only supports stand-alone compilation w/o ROCm SDK.

* Enable barebones HIP compilation.

Clang by itself is good enough to compile simple kernels that do not need ROCm
SDK headers and bitcode libraries.

Closes #2760
2021-07-19 21:55:23 -05:00
partouf a44c2ae83e lintfix 2021-07-08 15:07:12 +00:00
Marc Poulhiès 5fe6f140a5 Better handling of Kalray MPPA comment and bundle separator (#2768)
The KVX assembly uses ;; as the bundle separator, which can be a problem to
parse as ; is also commonly used as a comment marker.

Latest compiler version also adds cycle information for opt level >= 1, which
confuses the current comment filter that treats the bundle separator as comment.

Tune the regex to treat the following :

        addd $r12 = $r12, -96
        get $r16 = $ra
        ;;      # (end cycle 0)

as non-comment. The ';;  #' is special-cased as non-comment.
2021-07-08 16:45:15 +02:00
Matt Godbolt a4edf7ed6b No array for each 2021-05-28 18:08:05 -05:00
Matt Godbolt 4e36d206b4 Prefer regex.test() 2021-05-27 23:19:32 -05:00
Arseniy Zaostrovnykh 4f88b3f4ec Highlight ASM and LLVM IR lines corresponding to the given token and vice-versa (#2594)
* Highlight the lines in LLVM-IR corresponding to specific tokens

In addition to the highlighting of all the IR lines corresponding to the given
source line (using blue background), also make the lines corresponding to the
given token on that source line.

* Parse the optional source column number in the text asm

* Bolden the asm lines corresponding to the given token and vice-versa

* Ignore column number if it is 0; add a test with no column specified
2021-04-13 10:22:44 +02:00
Matt Godbolt 71e23aee6e Treat LLVM %blah = expressions as "opcodes"
Fixes #957
2021-04-01 15:37:16 -05:00
Rubén Rincón Blancoandpartouf 7f4c4a9ebf Report back an estimate of filtered lines (#2506)
* Report back an estimate of filtered lines

The commit is tested, but I had to remove an eslint check and
 not run the filter tests because I forgot how to bless them.

* Implement proposed wording change

* Add filtered report in compile info label

* Simplify and add reporting to binary mode filter

* Fix bad git stash shenanigans

* ignore filteredCount when testing

* filteredCount is not guaranteed to be returned

* extra check

Co-authored-by: partouf <partouf@gmail.com>
2021-03-20 20:17:38 +01:00
Patrick Quist 7edd6d40ac Time all the things (#2462)
* time executeDirect in ms

* measure library download and extract time

* time package download

* download timings when using execution checkbox

* proof of concept timing graph implementation

* use vertical bars for graph

* add objdump time

* add timing for asm parsing

* add timing graph to execution pane as well

* download timings on execution pane

* things
2021-03-11 17:37:57 +01:00
Patrick Quist 4737c7c11a support .d2line (#2375) 2021-01-07 14:16:34 +01:00
Patrick Quist 471474a64c fix regex for .weak and .weakext detection (#2370) 2021-01-02 16:10:53 +01:00
partouf 9b51556017 remove obsolete links prop in asm json 2020-10-05 23:24:00 +00:00
Matt Godbolt f68198af9e Reassign copyright to Compiler Explorer Authors (#2233) 2020-09-26 17:50:40 -05:00
Austin Morton 044dcfbf88 Use ES6 Modules (#2132) 2020-09-26 16:59:26 -04:00
Patrick Quist 356e87f202 .inst as an opcode (#2190)
* add directive exception for .inst

* unittests
2020-09-06 21:55:05 +02:00
Rubén Rincón BlancoandAustin Morton ccff4b9ee5 Add new eslint rules (#2121)
The largest changes here are:
- enforcing single quotes for strings
- enforcing trailing commas where possible

In addition to those we have enabled several eslint plugins:
- plugin:requirejs/recommended, to enforce some conventions in require statements
- plugin:node/recommended, to enforce correct usage of various node.js APIs
- plugin:unicorn/recommended, which contains a pretty mixed bag of useful rules

This PR attempts to not change code behavior when possible.  In cases where fixing
existing code would change semantics, a linting exclusion has been placed in the 
code base to silence the error.  You can find these by searching for `eslint-disable-next-line`.

Co-authored-by: Austin Morton <austinpmorton@gmail.com>
2020-08-04 16:39:02 -04:00
Iain BuclawandPatrick Quist 3a9da38e77 Recognize weak labels if a global isn't found (#2000)
Fixes #1989

Co-authored-by: Patrick Quist <partouf@gmail.com>
2020-06-08 12:10:29 +02:00
Iain BuclawandPatrick Quist ce0b7be667 Recognize globals emitted for the mcore and rx targets (#1999)
* Recognize globals emitted for the Motorola M*CORE target

* Recognize globals emitted for the Renesas RX target

Co-authored-by: Patrick Quist <partouf@gmail.com>
2020-06-08 12:09:39 +02:00
Iain Buclaw 1f720f3a2f Fix asm parser to recognize SPARC function definitions (#1998)
Refs #1989
2020-06-08 12:06:40 +02:00
RabsRincon 6ebefff9b3 Fixes Sentry issue COMPILER-EXPLORER-5W1
Applies formatting to asm-parser.js file too
2020-01-08 10:48:17 +01:00
Márton Csordás 6f6c0dbeb2 Fix review comments of the Jump to label feature
- Use `const` where it is possible.
- Move regexes into variables and give them a name.
- Eliminate `lineNumber` variable and use the length of the asm array.
- Use `updateDecorations()` function to decorate label usages.
- Update and fix test cases.
2019-12-04 20:56:21 +01:00
Márton Csordás c1d074d6d5 Parse assembly labels on the serve-side
Parsing the labels on the server-side is more general, more flexible
and it can be easily tested.

- Store label definitions in a map. The key will be the label name and
the value will be the line number where the label definition can be
found.
- For each line get the labels which are used in the given line and
remove labels which do not have a definition.
- Modify the return value of the `processBinaryAsm` and `process`
function to return with the label definition too.
- Demangle the label usages and the label definitions too.
2019-12-01 21:36:21 +01:00
Marc Poulhiès 10cd506b86 Handle K1 MPPA VLIW bundles in assembly
K1 MPPA uses ;; as a bundle separator (same syntax as IA64,
if it gets added to CE someday...).
The bundle separator must be alone on the line, see for example:

```
        ld $r6 = 16[$r20]
        addx8d $r9 = $r2, $r5
        addw $r10 = $r2, -1
        ;;
        addd $r0 = $r6, $r9
        addd $r17 = $r10, 1
        cb.wlez $r2? .L3
        ;;
        copyd $r15 = $r0
        ;;
        maddd $r15 = $r17, -8
        ;;
```

Single ; or ;; followed by any non whitespace before eol still
considered a comment.
2019-11-21 21:08:24 +01:00
Dmitry Gerasimov d09a0ace40 Fix path handling for clang-style file directive
E.g. for such directive

    .file   1 "/home/user" "example.c"

now will be constructed valid path:

    '/home/user/example.c'

instead of this broken path:

    '/home/user/ "example.c"'
2019-11-14 01:47:20 +03:00
Matt Godbolt 57e2bae56c Bump the number of lines in a disassembly. This is a decent-sized bump up but still is not so much to destroy a web browser. Improves the specific case in #260 2019-10-26 12:47:59 -05:00
Partouf f14746b36a bugfix replace single line /*comments*/ 2019-10-25 17:19:53 +02:00
Ben Barsdell 1983e4ad41 Add basic support for CUDA native SASS assembly
- Enables "Compile to binary and disassemble the output" for CUDA source.
- Parses labels, line numbers, opcodes and disassembly.
- Fixes #946
2019-09-15 14:48:16 -07:00
Partouf 9b89389f34 fixes #1285 2019-04-30 21:05:48 +02:00
Matt Godbolt eb0a45d71f * Add 6502 support
Kills consecutive blank lines in asm output. Handles labels and
opcodes on the same line. Adds cc65 compiler support.

See #82
2019-03-31 11:45:51 -05:00
Matt Godbolt 2e7fc5fe80 Super minor tweaks to @bugwelle's awesome PR for LLVM IR mode! 2019-03-21 21:28:43 -05:00
Matt Godbolt b87322568e Merge branch 'master' into llvm 2019-03-21 20:31:42 -05:00
Sebastian Staffa 0da2ad1221 fix #dfc3b32 2019-03-03 13:54:21 +01:00
Partouf 18bf4cf6f8 fix #1229 2018-12-20 16:21:00 +01:00
Partouf f7ff8835ab remove labels that belong to libraries, added tests 2018-12-18 00:06:57 +01:00
Andre Meyering 8563b21522 [ASM Parser] Fix tests (add "filterAsmLine")
- was removed by previous commit which was rebased
2018-11-28 14:29:10 +01:00
Partouf 4baea3178b dont just filter labels 2018-11-18 17:19:29 +01:00
Partouf eb4e744853 support more c++ compilers 2018-11-18 16:34:00 +01:00
Matt Godbolt ad7f192951 Treat groups of labels next to each other as equivalent for the purposes of determining live/deadness. Fixes #1179 2018-11-17 12:58:59 -06:00
Partouf b691b3f52e support for binary mode on VS compilers 2018-11-08 16:52:31 +01:00
Matt Godbolt eabe33c166 Minor refactoring to extract filterAsmLine in one place. Starting to think about fixing #883 2018-10-22 23:00:28 -05:00
Matt Godbolt 8a43d59504 Treat xword as a data directive. Fixes #1081 2018-09-23 08:14:08 -05:00
Nicole Mazzuca 9ddf22f090 Support Visual C++ and Windows well
This commit adds support for hosting on windows, as well as better
support for the Visual C++ compiler. Specific interesting changes are:

  - switch from /FAsc to /FA
  - order functions in file order
  - support demangling win32-style identifiers with undname
  - clang++ and vc++ on win32 host are both supported
2018-07-28 15:18:43 -07:00