Commit Graph
879 Commits
Author SHA1 Message Date
Steve 1e02873328 Remove the restrictions on compiler options (#7143)
Follow up to #7141

As per
https://github.com/compiler-explorer/compiler-explorer/pull/7141#issuecomment-2506116434,
remove the restrictions on compiler options.

cc: @junlarsen
2024-11-28 15:52:14 -06:00
Matt Godbolt 6fa1dede79 Add lfortran and a slightly hacky path to clang (#7149)
Advice sought: I didn't want to plumb through a whole new compiler flag
for `clang` so used a top-level one for `fortran` in the form of a
`ceProp` (which doesn't cascade through all the groups etc). I think
this is _ok_ but ugly and surprising (To me...) and I wonder if we
should actually consider making each compiler's `ceProps` use the same
logic as the logic in the discovery process with parent properties
etc...or not. (cc @partouf in case I've missed something obvious!)
2024-11-28 15:51:51 -06:00
Thirumalai Shaktivel d5ccd7cf20 [feat] Add LFortran as a new fortran compiler (#7119)
Details:
LFortran is a modern open-source (BSD licensed) interactive Fortran
compiler built on top of LLVM. See, https://lfortran.org for more
details.
 There was an interest in the community to add the compiler into the 
 Compiler Explorer: https://github.com/lfortran/lfortran/issues/623. 
 So, this PR adds it.

LFortran is in alpha (the source code compiles to binary and execute. 
 But, users are expected that their code can break). It can emits AST, 
 ASR, LLVM, C, C++, WAT, Julia, Fortran, etc. It has multiple backend
 like LLVM (default), C, C++, x86, WASM, fortran and mlir. 
 For more options run `--help`.

Changes in this PR:
- Add LFortran as a new Fortran compiler.
- `-g` options is enabled by default in `optionsForFilter`. Providing an
option
to disabling it helps other compilers (that doesn't have complete
support for
 debug information) to compile successfully
2024-11-28 10:45:01 -06:00
Steve f667fb700b Allow passing --help to compilers (#7141)
As per
https://github.com/compiler-explorer/compiler-explorer/issues/6199#issuecomment-2505980377,
allowing passing `--help` to compilers so that users can know what
options and switches are available (though part of them will be filtered
out, but still better than having nothing).
2024-11-28 22:37:39 +09:00
Benjamin MaxwellandMats d5a016471c Support LLVM IR filters for the output of mlir-translate (#6881)
This enables the LLVM IR filters for the output of `mlir-translate`
(with `-mlir-to-llvmir`). The filters are still disabled for `mlir-opt`
(which only outputs MLIR) as there's currently no support for MLIR
filtering.

<!-- 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!
-->

---------

Co-authored-by: Mats <mats@jun.codes>
2024-11-28 22:13:19 +09:00
Steve f311fbb3e9 .NET: Set languageId for ILSpy (#7138)
The compile result of ILSpy is C# code, so use `csharp` for
highlighting.
2024-11-28 10:01:33 +09:00
kevinjeon-g b2b39017c0 Support system properties in the R8/D8 invocation (#7113)
This change supports JVM system property input by reordering user-input
compiler options that begin with '-D' or '-J'. The latter is an R8/D8
convention; the 'J' is stripped before being used.

Other compiler options are assumed to still apply to R8/D8.
2024-11-26 18:45:33 -06:00
chibitanaka 86f439fc92 Add Vyper support (#7088)
Hello! I'm a big fan of Godbolt and use it regularly to test gas
optimizations in Solidity. However, to this day, there is no support for
Vyper, the second most popular language targeting the EVM, related issue
#4165. We at Statemind.io thought that adding Vyper support would
greatly benefit developers and security researchers, so here is our
attempt to get it working :)

This PR **is not ready** for merging, as `vyper.defaults.properties` and
`vyper.amazon.properties` are not yet defined. I have a few questions to
clarify how to integrate it on the public instance and infrastructure
repository:

Because Vyper compiler is basically a python module, I've found success
in testing multiple versions via separate `venv` environments. In my
local tests `vyper.local.properties` was the following:
```INI
compilers=vyper
compilerType=vyper

versionFlag=--version

compiler.vyper.exe=/opt/research/godbolt/venv/bin/vyper
compiler.vyper.isSemVer=true
compiler.vyper.instructionSet=evm
compiler.vyper.options=--optimize none
```

The versions tested are the latest major Vyper release 0.4.0, along with
0.3.10 and earlier 0.3.xx releases.

It appears that there is support for running python in a virtual
environment in the infra repository:

https://github.com/compiler-explorer/infra/blob/main/bin/lib/installable/python.py

However, I've had difficulties getting started with it and would greatly
appreciate any assistance. Thank you!
2024-11-26 16:38:40 -06:00
Steve 2a55dce7fc Add support for .NET 9.0 and ILSpy (#7124)
- Adding support for .NET 9.0
- Adding support for ILSpy
- Make some changes to the compiler name so that the meaning of the
version is more cleared
- Adding missing compilers for existing .NET versions

cc: @mattgodbolt
2024-11-26 13:20:02 -06:00
Ofek 20b8ccaa6f Remove ICompiler, other minor type fixes (#7079) 2024-11-25 18:36:20 +02:00
Cr0a3 636675c476 [FIX] fixed argument passing for ygen (#7120) 2024-11-24 18:42:55 +01:00
Ofek 717c9173ad Unify OptCodeEntry and LLVMOptInfo (#7077) 2024-11-14 13:05:26 +02:00
Partouf 6544587d35 fix 2024-11-08 16:34:31 +01:00
Spencer Fricke 13bd12a975 Add SPIRV-Cross and SPIRV-Reflect (#7056) 2024-11-08 16:31:51 +01:00
Spencer Fricke 7a19db3378 Add success message for validator tool (#7055) 2024-11-08 16:29:05 +01:00
Spencer Fricke 4651cbd7bb Add Glslang Argument Parser (#7051) 2024-11-08 16:28:00 +01:00
Spencer Fricke 721b45b35b Add richer comments to SPIR-V assembly output (#7052) 2024-11-08 16:27:32 +01:00
Spencer Fricke 02603a6371 Add SPIR-V language with SPIRV-Tools compilers (#6947)
for https://github.com/compiler-explorer/compiler-explorer/issues/2331

Hey, so I am currently trying to improve the SPIR-V ecosystem, in-charge
of the [SPIR-V Guide](https://github.com/KhronosGroup/SPIRV-Guide), and
part of the SPIR-V Working Group. We talked at our last Face-2-Face
gathering about getting more support for GPU tooling in something like
Compiler Explorer because you have all made this such an amazing tool!

I have enjoyed working in this codebase and happy to help keep improving
the SPIR-V as people find issues or want enhancements (I was already
about to spend time rebuilding Compiler Explorer, so happy to donate my
time to a single tool's effort)

(For those who haven't spent last few years staring at SPIR-V)

- SPIR-V is a an IR (very much like LLVM IR) but for GPUs
- SPIR-V can be used for Graphics and Compute
- Compute:
    - Can be tied to things like clang, llvm, mlir, OpenCL, etc
- One could take `spirv` as a language and compile it to something like
x86
      - (Future PRs for this realm of things)
- Graphics:
- Much harder to actually "compile" to any ISA because other graphics
pipeline information is missing that will effect the final ISA
- Microsoft has even now planned to move to [SPIR-V for DirectX
soon](https://devblogs.microsoft.com/directx/directx-adopting-spir-v/)
- Both:
- There are many tools that run on SPIR-V regardless (hence why they
share the same IR)
    - Being able to do tooling in compiler explorer would be AMAZING

This PR adds `SPIR-V` as a language and a new `SPIRV-Tools` compiler as
an initial compiler for it the language (since we already have the
SPIRV-Tools repo being pulled in on the infra side!)

I personally use `spirv-opt` and `spirv-val` the most and have been
testing this locally for a few days and feel it is ready to go. I plan
to slowly add more tools (ex. `spirv-fuzz`, `spirv-cross`,
`spirv-reflect`, etc)

Cheers!

(some screenshots of course)

![image](https://github.com/user-attachments/assets/419feab0-d030-4578-b32a-ef1cf95701da)

![image](https://github.com/user-attachments/assets/a00fa60f-7f05-4522-a9fc-1c43ecee1c42)
2024-10-28 21:24:50 -05:00
Ofek 63dd5e35a5 Various tsifications (#7025) 2024-10-27 15:28:38 +02:00
Ofek f6438f9c4d Store times in numbers only (#7023)
Also fixes #4655
2024-10-26 18:43:59 +03:00
Patrick Quist 4fe8397fac Remote execution (#6700) 2024-10-26 17:42:22 +02:00
Ofek 648795d0f5 Unify CompileChildLibraries and SelectedVersionLibraries (#7022) 2024-10-26 15:53:27 +03:00
Ofek c312beae24 TSify StackUsage and others (#7021) 2024-10-26 11:35:35 +03:00
Ofek 4e5348ab77 Tsify tools (mostly) (#7018)
This includes among others:
 - Proper tsification of various tools code,
 - Elimination of the `CompilationInfo2` type,
 - Use of `CompilationInfo` instead of `Record<any, any>` in some places
 - These lines in CompilationResult:
```
    // Temp hack until we get all code to agree on type of asm
    asm?: ResultLine[] | string;
```

The next task would be to get all code to agree on the type of
CompilationResult.asm, thereby enabling fixing of most the remaining
TSification.
2024-10-26 10:58:30 +03:00
Ofek c1985d64a1 Tsification binge #7 (#6974) 2024-10-25 12:19:04 +03:00
Ofek bb712dff81 Fix #6967: drop external contracts in SolidityCompiler.processAsm (#7011) 2024-10-24 15:34:36 +03:00
Ofek 2df8d32758 Tsify #6 (#6941)
Another tsification batch. 347 to go and I'm running out of easy fixes
:(
2024-10-22 21:41:44 +03:00
Cr0a3 43fbfcd19f Adding ylc (#6982)
Hi dear godbolt team,

> Before opening the PR, please make sure that the tests & linter pass
their checks,
 > by running `make check`.

With this pr i added support for the ylc compiler.

Infra-PR: https://github.com/compiler-explorer/infra/pull/1441
2024-10-22 06:37:40 -05:00
Steve 35cd137722 Do not cache the sdk version and compiler path (#6973)
Godbolt caches the compiler instance so that the version string won't be
recalculated if there's an update to the compiler image.
Do not cache that information, instead reevaluate them whenever we do
the compilation.
2024-10-21 08:52:37 -05:00
Steve 06068ef1e0 .NET: Stop using a response file (#6943)
Using a response file can prevent nsjail from replacing the file name in
args. Passing all args directly to the compiler instead.

Fixes
https://github.com/compiler-explorer/compiler-explorer/pull/6928#issuecomment-2398361491
2024-10-08 09:48:13 -05:00
Ofek 05dfb2034e tsify argument-parsers.ts (#6929)
470 ts violations to go.
2024-10-07 22:24:18 +03:00
Steve c2de66114b .NET: Invoke compiler directly to speed up compilation (#6928)
After this PR, compilers will be invoked directly instead of relying on
the built-in `dotnet build` command which involves restore and many
other expensive resolution operations.
This should speed up the compilation process a lot.
2024-10-02 20:56:22 -05:00
Steve 30b77d380e IL: Fixes include path for Linux (#6922) 2024-10-01 14:32:19 +02:00
David Spickett 7f2c985a7f Flang: Remove flang-to-external-fc support and "new" from names (#6908) 2024-10-01 14:09:34 +02:00
Ofek f5f00606f8 Tsifications galore (#6916)
Still mostly mindless numb work, one rename that touched many files
(`getArgumentParser` -> `getArgumentParserCls`), and a few real
improvements.
The goal is to be able to turn on `noImplicitAny` for the project, to
enforce higher code quality. 600 violations to go.
2024-10-01 12:26:46 +03:00
Spencer FrickeandMatt Godbolt 69241006aa Add preliminary GLSL support (#6883)
Part of
https://github.com/compiler-explorer/compiler-explorer/issues/2331
Inspired by
https://github.com/compiler-explorer/compiler-explorer/pull/3932

I think it is great that HLSL has support here, but the lack of GLSL
support is what stops me from using Compiler-Explorer more often. LunarG
also have shown in our [yearly ecosystem
survey](https://www.lunarg.com/wp-content/uploads/2024/04/2024-Vulkan-Ecosystem-Survey-Results-04-04-2024.pdf)
that GLSL is very widely used in the GPU space

![image](https://github.com/user-attachments/assets/ec740d61-0bf4-42b2-8e51-c204819aba11)

A while ago I started to create [my own SPIR-V
tool](https://github.com/sjfricke/SPIRV-Playground) but was given
feedback to "please just spend your free-time efforts making
compiler-explorer better for SPIR-V instead" ... to which I agree (since
seems a LOT of ground work was already laid out for me 😄 )

So here it is, a working version of GLSL using `glslang` 🚀 


![image](https://github.com/user-attachments/assets/2fc67890-1cd2-4b7e-82c2-30ca135f8590)

I guess beside reviewing my very unused Typescript skills, I know we
will need to add things to the Infra repo to get things public. For that
I am not sure what the best course of action is, we do have [rolling
releases](https://github.com/KhronosGroup/glslang/releases/tag/main-tot)
of `glslang` as well as SDK version tags

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2024-09-30 22:19:55 -05:00
Ofek 7097a240a7 Introduce opt-pipeline for ClangIr (#6917)
Thank @Lancern for the CIR flags analogous to clang's
`--print-before|after-all.`


![cir](https://github.com/user-attachments/assets/78742d83-799d-40cd-bcef-7a2e69a83c54)
2024-09-30 22:11:30 -05:00
Steve ee2dc8ab00 Update asm parser and add support for IL and IL disassembler (#6856)
Supersedes #6842 

- We now have the upstream issue of `JitDisasmAssemblies` fixed. Enable
it for net9.0+.
- Update asm-parser to support CoreCLR and NativeAOT (Fixes #6833)
- Adding support for IL language
- Adding support for IL disassembler
- Fixes #6629
2024-09-29 13:15:47 -05:00
Partouf 6c66940109 bugfix fixIncompatibleOptions 2024-09-29 15:21:37 +02:00
Ofek f715dc2932 More tsification (#6877)
About half way through. Only 708 tsification errors to go..
2024-09-28 10:32:36 +03:00
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
Ofek fecd0fbf11 tsification + small package upgrade (semver) (#6841) 2024-09-10 17:18:48 +03: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
Steve 81816f29ac .NET: Enhance NativeAOT compilation (#6792) 2024-09-07 10:15:07 +02: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