2421 Commits
Author SHA1 Message Date
Patrick Quist 71eb1c3503 remove debug code 2024-09-12 18:56:55 +02:00
Sirui Mu a49dbc6dd7 Add ClangIR output for clangir compiler (#6798)
Currently the clangir compiler is implemented by a special clang variant
whose compilation options list gets appended with `-Xclang -fclangir
-Xclang -emit-cir`. This introduces a problem: we no longer gets access
to its LLVM IR output and assembly output because `-emit-cir` is an
exclusive option.

This patch resolves this problem by introducing a new ClangIR pane,
similar to the LLVM IR pane or Rust MIR pane. A new output kind named
`ClangIR` is added to the "Add new..." drop down menu and it toggles the
ClangIR pane. This patch then removes `-Xclang -emit-cir` from the
options list of the clangir compiler. The clangir compiler will then
output assembly code just like other clang compilers. The removed
options will be added back when compiled from the ClangIR pane.
2024-09-12 19:43:26 +03:00
Patrick Quist 1ea5d97854 Pascal parse mess (#6852) 2024-09-12 00:26:49 +02:00
Patrick Quist 87d6f97bcc fix clientstate overrides and runtime tools and fix unittests (#6848) 2024-09-11 14:49:38 +02:00
Ofek fecd0fbf11 tsification + small package upgrade (semver) (#6841) 2024-09-10 17:18:48 +03:00
Patrick Quist 9372f158b3 Old golden layout branch? (#6844)
What is this and why didn't I finish this?
2024-09-10 15:58:07 +02:00
Ofek 9ef46fbafe Binge of (mostly) mindless tsification (#6838)
Turned on `noImplicitAny` in tsconfig, then went around fixing some
random easy stuff.
Hopefully tsification-PRs with more real content coming up.
2024-09-07 14:36:43 +03:00
Patrick Quist 1ee2b72e36 Add libSegFault support as runtime tool (#6834) 2024-09-07 10:16:53 +02:00
Steve 81816f29ac .NET: Enhance NativeAOT compilation (#6792) 2024-09-07 10:15:07 +02:00
Mark Hansen 9a1eb76d54 Add a new dex instruction set (#6820)
And use it for Android d8 compiler.

It's empty for now. But it lets you filter in the compiler pop out box.
And it may let us attach hover assembly documentation later.

I've left it empty in `lib/instructionsets.ts` like `java` is, which I'm
modelling this off.

Towards #6819
2024-09-06 17:20:40 -05:00
Patrick Quist 3a278ad3b3 Add library lookupname to support binary builds for boost (#6814) 2024-09-04 19:18:37 +02:00
Detjon Mataj 53c04b26af Add bloaty tool for C, C++, D, Rust and Pascal (#6790)
Added `bloaty` tool configuration for C, C++, D, Rust and Pascal. 

resolve #6240
2024-08-24 15:01:26 -05:00
Chris Apple fcf60543b2 Add missing sanitizer symbolizer paths to clang ENV (#6791) 2024-08-24 19:37:29 +02:00
Steve ef323ab4ba .NET: Add mono and NativeAOT support (#6788)
Adding support for mono and NativeAOT.

As for NativeAOT, we have some upstream issues need to be resolved
before we can use `JitDisasmAssemblies` to print disasm for the
specified assembly only, where it would fail with:
```
Unhandled exception: ILCompiler.CodeGenerationFailedException: Code generation failed for method '[S.P.CoreLib]<Module>..cctor()'
 ---> System.NotImplementedException: getClassModule
   at Internal.JitInterface.CorInfoImpl.getClassModule(CORINFO_CLASS_STRUCT_*) + 0x2b
   at Internal.JitInterface.CorInfoImpl._getClassModule(IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*) + 0x39
   --- End of inner exception stack trace ---
   at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode, MethodIL) + 0x273
   at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode, MethodIL) + 0x63
   at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl, MethodCodeNode) + 0x97
   at ILCompiler.RyuJitCompilation.CompileSingleThreaded(List`1) + 0xee
   at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1) + 0x173
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x159
   at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) + 0x26
   at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x5d
   at ILCompiler.Program.Run() + 0x2a55
   at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass240_0.<.ctor>b__0(ParseResult) + 0x321
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult) + 0x6f
```
For now, workaround with removing `JitDisasmAssemblies` and print disasm
for all assemblies instead. (see the second commit)

/cc: @MichalStrehovsky We need to implement `getClassModule`,
`getModuleAssembly` and `getAssemblyName` in ilc to make
`JitDisasmAssemblies` work correctly.

Closes #5668
2024-08-24 08:52:15 -05:00
Ofek 7f8d4eb84d When rust edition appears in both overrides and compiler-options, prefer the options (#6789)
Fix #5429, #6559
2024-08-24 11:06:00 +03:00
kevinjeon-g 5480ec6bb7 Enable --force-allow-oj-inlines (#6776)
This allows for inlining behavior that is more similar to the inlining
that will occur when compiling on a device.
2024-08-22 10:27:27 -05:00
Ofek 1234363d8e Fix in clang-format arg handling (#6782)
Fix #6765: don't let an empty `stdin` override explicit args
2024-08-22 13:34:41 +03:00
Ofek 00648a7e1c Robustify SolidityCompiler (#6769)
Fix #6512
2024-08-17 14:07:13 +03:00
Ofek dd03812b31 Remove '-p' from forced demangler args (#6750)
Minor added tsification

Fixes #6714 : "No demangling in opt-remarks for clang <=17"

This is probably a regression introduced by my PR #6451 - which changed
the version of the llvm-cxxfilt demanglers used. Up until llvm 18 these
demanglers did not support the `-p` switch ("Skip function parameters
and return types").
The fix here is to remove the switch (why would we want it?? We wish to
distinguish overloads in opt remarks too).
2024-08-08 12:26:38 +03:00
kevinjeon-g 389d77ecb2 Update Android templates with ProGuard keep rules (#6746)
This change adds ProGuard keep rule input for R8 in the Android
Java/Kotlin IDE templates.
2024-08-04 15:21:34 -05:00
Ofek d8981527d7 Rewrite the llvm-opt-transformer functionality (#6749)
… to be synchronous and not fail on bad document
Fixes #6745.

One problem is described in https://github.com/compiler-explorer/compiler-explorer/issues/6745#issuecomment-2266054446 . Also, moved to the library function `yaml.parseAllDocuments` which doesn't throw.  Also, stopped `generateIR` from interfering with opt.yaml writes.
2024-08-04 14:54:06 +03:00
Peter Waller 38b2d9a16e Improve passthrough of -march and -mcpu from compiler to llvm-mca (#6710)
This patch fixes a few issues with argument passthrough that have been
discovered since #6682 was landed.

* X86 didn't work if -march=CPU was supplied.
* It wasn't possible to override flags on MCA, because the auto-detected
  flags came before user flags.
* Since compiler-explorer runs on x86 native hardware, if targetting
  aarch64, it would result in an error about the default requested
  native CPU not being available for the architecture.

X86 clang uses -march to specify the CPU, and it's invalid to supply
-march=<cpu> to LLVM-MCA. Meanwhile, LLVM-MCA requires an -mcpu
argument.

Therefore, to handle x86 it's necessary to rewrite -march to -mcpu so
long as the march flag is used to supply a CPU value (i.e. not an
architecture level beginning with `x86-64`).

Per https://maskray.me/blog/2022-08-28-march-mcpu-mtune, I understand
x86 is currently the only target to have this behaviour so it needs
special casing.

Additionally, llvm-mca assumes -mcpu=native if it is not otherwise
specified. Since compiler-explorer runs on x86 hardware, it is easy to
end up in a situation for example targetting aarch64 but with -mcpu=<an
x86 CPU>. To handle this case some logic is added to detect if a CPU is
not specified and the target is not x86, in which case -mcpu=generic is
supplied instead as a reasonable default for the target.

Further, handle the case where --target is being passed to the compiler,
and pass this through as -mtriple.

Testing:

* I have been testing on an aarch64-native machine.
* I have tested targeting x86 by specifying --target and using the
  override functionality in compiler explorrer to specify x86.
* I have been inspecting the `--debug` output to see what flags are
  passed to LLVM-MCA.
* I've checked that I can override the -mcpu in MCA regardless of what
  is passed to the compiler.
* I have checked that I can supply either -march=x86-64* or -march=<cpu>
  on the x86 target and things behave as expected.

Fixes: #6709
2024-07-31 20:16:50 -05:00
kevinjeon-g 1a5a5c4813 Set default min API to 27 for R8/D8 (#6698) 2024-07-25 18:11:13 +02:00
Ofek 42c10cf9b3 Fix #6083: rewrite demangleLabels (#6701)
This code had some problems:

https://github.com/compiler-explorer/compiler-explorer/blob/07d5c3312fce98d2742fa7ed738d4084f3a6975f/lib/demangler/base.ts#L200-L203
There

`PrefixTree.replaceAll` replaces mangled to demangled names 'blindly',
with no notion of labels. Later `demangleLabels` runs separate logic to
update the column-range of each label in hope of mimicking the
`replaceAll` action. This fails in some cases:
(1) the `demangleLables` code handles only a single occurrence of each
label in a line,
(2) It also diverges from `replaceAll` in case that a string which is a
label-name appears in the line *not* as part of a label (this does
happen!).

This fix makes `replaceAll` return detailed account of its actions, and
then use these to properly adjust the label ranges.

This fix might not address all the root issues, but it does make some
`label` decisions consistent where they weren't.
2024-07-13 17:38:32 +03:00
Boris Verkhovskiy 07d5c3312f Set -fverbose-asm/-fno-verbose-asm from Comment filter (#6462)
~~This removes useless comments (namely repeated function/label names,
`<n>-byte Folded Spill` and others) from the generated assembly.~~

Fixes #5964
2024-07-10 20:19:32 +03:00
Peter Waller 928f3b2ab0 Pass instructionSet, -mcpu, -march and -mtriple through to llvm-mca (#6682)
Currently if an MCA instance is constructed on a compiler, MCA runs with
the default target for the host it is running on.

Make it respect the target architecture by passing an -mtarget to MCA
conditioned on the detected instructionSet of the compiler.

Additionally, pass through any -mcpu, -march or -mtriple specified to
the compiler.
2024-07-10 06:53:45 -05:00
Patrick Quist 75acc5bd44 Attempt to detect faulty compiler/language population (#6610) 2024-07-07 13:09:51 +02:00
Nicholas Hubbard a9257430f3 Add assembly documentation for PowerPC platform (#6665)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->

Hello all, I've added assembly documentation for the PowerPC platform
with this PR.

There's a couple of notes to keep in mind, mostly regarding automatic
processing:

1. Unfortunately, IBM made their documentation site very difficult to
automatically scrape. It uses dynamic rendering with a documentation API
that's protected by cookies, requiring the use of Selenium to scrape it.
2. While it is possible to scrape the documentation pages, it's
maddeningly difficult to do so, because the structure of the pages is
not guaranteed.
- Some pages have invisible elements in their headers that make matching
elements very difficult.
     - Some pages are missing entire sections.
- Some pages are written without an introduction for the instruction
mnemonic, making the resulting documentation impossible to understand.
- Some pages, specifically for instructions without arguments, are
missing the table that lists the mnemonics out in order.
- I could go on, but I abandoned trying to do automatic processing after
running into this many roadblocks.
3. The automatic processing script is available in the docenizers
directory, but since it's not complete, feel free to ask to remove it.
4. I couldn't test the actual mnemonics appearing the editor, because my
local test setup kept trying to map the PowerPC instructions into AMD64
documentation, with predictably unusual results.
5. I didn't include AltiVec instructions, because there isn't any
webpage that documents them; they are only documented in a PDF file
provided by NXP.

Please let me know if there's anything else I need to do for this to
work. Thank you so much for your wonderful service!
2024-07-01 14:52:10 +02:00
kevinjeon-g 1c051bd479 Add R8 for Android (#6591)
R8 is a whole-program optimizer that converts Java byte code to
optimized dex code. It can be run with the same general steps (and JAR)
as the existing D8 compiler.

This change adds R8Compiler and the R8 keep-annotation library it relies
on, makes this lib + Android API stubs default libraries for Android
Java/Kotlin, and includes a small update to allow older versions of
dex2oat (33.10) to run.

https://r8.googlesource.com/r8
2024-06-25 18:43:02 -05:00
kevinjeon-g 99617a29b2 Move dex2oat profiles from inline to template (#6621)
This change moves the dex2oat profiles for Android Java and Kotlin from
the inline comments (included as part of the default code example) to
being included as a separate file. Templates have been added for this.
2024-06-24 21:33:31 -05:00
Marc Poulhiès 6a97ce2cad Unbreak rustc_cg_gcc
Fix lib path.

refs https://github.com/compiler-explorer/compiler-explorer/issues/5342

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-06-22 16:34:34 +02:00
Marc Poulhiès 924bdfa363 Adjust rustc_cg_gcc compiler invocation (#6583)
Adjust a bit how we call the compiler:
- panics are handled, no need to force abort (and -Cpanic=abord doesn't
work without other tuning)
- adjust some paths

refs https://github.com/compiler-explorer/compiler-explorer/issues/5342

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-06-21 20:31:40 +02:00
Matt Godbolt e91b5d12da Comply with some MS terms (#6627)
- Ensure MSVC license terms are clearly shown to the user.
- Simplify config of vc and vcpp slightly by extracting common stuff
into a group.
- Remove reference to MS privacy policy
2024-06-19 18:09:59 -05:00
Ofek 3db92c3753 Fix rust IR function/label parsing (#6594)
Fixes at least #6554.

Modified to not clash with @narpfel 's earlier fix to #6558
2024-06-19 22:01:05 +03:00
Patrick Quist e3118f36ca add some msvc compilers (#6616) 2024-06-19 02:46:02 +02:00
Anton Baliasnikov ac57dde2d0 Add ZKsync solidity compiler 1.4.1 and 1.5.0 (#6592)
## ZKsync solidity compiler

Adds two latest releases of **ZK**sync solidity compiler (`zksolc`)
`v1.4.1` and `v1.5.0`.

Related infra change:
https://github.com/compiler-explorer/infra/pull/1324
2024-06-17 21:12:04 -05:00
Stephen Tozer be9c26b6de Add support for filtering debug records in LLVM IR (#6618)
In LLVM, debug records (`#dbg_value`) are now being printed by default
in LLVM IR instead of debug intrinsics (`call void @llvm.dbg.value`). As
the debug info filters don't recognize debug records, this means [IR
output from clang-19 (trunk)](https://godbolt.org/z/fPbdEhYsn) and
onwards will always show debug variable output.

This patch adds debug records to the filters to fix this.
2024-06-17 21:07:21 -05:00
SteveandPatrick Quist b8df2e3dab Refactor and adding new dotnet compilers (#6522)
Depends on https://github.com/compiler-explorer/infra/pull/1312.

I'm considering to unify all old compiler versions per dotnet minor
version as patch upgrade in dotnet doesn't change the codegen. New patch
versions come with quality updates like bug and security fixes, we only
need the latest version per minor dotnet version instead. Here a version
is consisting of `major.minor.patch`, such as `7.0.3` and `8.0.5`.

i.e.
- `dotnet6030csharp:dotnet6018csharp:dotnet6014csharp:dotnet6011csharp`
-> `dotnet60csharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030fsharp:dotnet6018fsharp:dotnet6014fsharp:dotnet6011fsharp`
-> `dotnet60fsharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030vb:dotnet6018vb:dotnet6014vb:dotnet6011vb` -> `dotnet60vb`,
and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`, `6.0.14` and
`6.0.11` are all `6.0`
- `dotnet7019csharp:dotnet707csharp:dotnet703csharp:dotnet701csharp` ->
`dotnet70csharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019fsharp:dotnet707fsharp:dotnet703fsharp:dotnet701fsharp` ->
`dotnet70fsharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019vb:dotnet707vb:dotnet703vb:dotnet701vb` -> `dotnet70vb`,
and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`, `7.0.3` and `7.0.1`
are all `7.0`

I'm keeping the minor version (ie. `.0`) in the name as there may be
updates like `.NET Core 3.1` to `.NET Core 3.0` which does change the
codegen.

The compiler structure now is:

```
group: dotnetcoreclr
.NET (main)
.NET 8
.NET 7
group: dotnetcrossgen2
.NET (main)
.NET 8
.NET 7
.NET 6
group: dotnetlegacy
existing compilers for backward compact
```

---------

Co-authored-by: Patrick Quist <partouf@gmail.com>
2024-06-11 14:09:23 -05:00
Afonso BordadoandPatrick Quist bdb5feaea3 Add webassembly language (#6429)
👋 Hey,

This PR adds support for the Webassembly Text Language (#1871).
Currently it only supports the
[wasmtime](https://github.com/bytecodealliance/wasmtime) compiler, but
it should be possible to add others (i.e. v8 / wasmer / etc...).

It looks like the monaco does not support the WAT language, so I've
added a simple mode for it, that is mostly copied from the clojure mode
with some changes. From what I've tested it seems to work reasonably
well.


![image](https://github.com/compiler-explorer/compiler-explorer/assets/1357143/9e38b28e-235c-47e5-a71e-50217e5d2056)

---------

Co-authored-by: Patrick Quist <partouf@gmail.com>
2024-06-10 21:29:03 -05:00
narpfel 7974f78e08 Also demangle quoted identifiers in LLVM IR (#6560)
This fixes one of the two problems reported in #6558.
2024-06-07 20:49:45 -05:00
kevinjeon-g bf91208c97 Support Android API stubs (#6514)
Updates the d8 and dex2oat compiler implementations so that android.jar
is included in the classpath for javac/kotlinc.
2024-06-07 19:18:46 -05:00
Patrick Quist 466346c208 fix kotlin execution result when compilation fails (#6556)
Fixes https://github.com/compiler-explorer/compiler-explorer/issues/6547
2024-06-05 18:18:55 +02:00
Ofek 2f117a24c3 Fix llvm-ir-cfg: callbr might be multiline, AND might start with %1 = (#6546)
Fixes #6545
2024-06-01 17:33:04 +03:00
Jason Francis 97a39232b2 Detect local label assignments as directives on MIPS (#6392) (#6467) 2024-05-29 18:13:16 +02:00
Ofek ca28aec7a8 Remove unused events filtersChange, requestFilters, some added types to BaseCompiler.compile (#6486)
Just some minor housekeeping.
2024-05-29 18:10:21 +02:00
Patrick Quist d2c7a5222e Local/Remote Execution environment (#6413) 2024-05-26 22:09:01 +02:00
Ofek 42533d8dbb Stop duplicating hasXXoutput + XXoutput (#6476)
When you need to check if `XXoutput` exists, check it directly.
+some TSification in CompilationResult
2024-05-14 20:11:09 +03:00
Ofek bcb397f56b Add noUnusedLocals to tsconfig + fix the new alerts (#6396)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2024-05-14 18:46:22 +03:00
Ofek 402c5ec890 Mark the go compiler gc as not supporting cfg (#6470)
Following #6439: mark the go compiler `gc` as not supporting cfg.
Also, don't pass argument to `isCfgCompiler` - the base-compiler
implementation uses `this.compiler.instructionSet` anyway.
2024-05-12 02:16:51 +03:00
harishch4 15bcb0ab3d Add Flang frontend driver to Fortran Compilers (#6419) 2024-05-10 20:47:29 +02:00