mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
Add support for Swift LLVM IR (#8180)
This adds support for the LLVM IR view for Swift, based on what other LLVM based compilers do. I tested it on my machine and it seems to work well, including with the demangler. I'm not sure what `minIrArgs` is though, I added it because it was there for other languages. Co-authored-by: Nathan SALAUN <nathan.salaun@sofia.dev>
This commit is contained in:
@@ -165,4 +165,4 @@ From oldest to newest contributor, we would like to thank:
|
||||
- [Florian Freitag](https://github.com/flofriday)
|
||||
- [Trevor Gross](https://github.com/tgross35)
|
||||
- [Alex Trotta](https://github.com/Ahajha)
|
||||
|
||||
- [natinusala](https://github.com/natinusala)
|
||||
@@ -22,6 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
import {CompilationEnvironment} from '../compilation-env.js';
|
||||
@@ -35,6 +37,9 @@ export class SwiftCompiler extends BaseCompiler {
|
||||
|
||||
constructor(info: PreliminaryCompilerInfo, env: CompilationEnvironment) {
|
||||
super(info, env);
|
||||
this.compiler.supportsIrView = true;
|
||||
this.compiler.irArg = ['-emit-ir'];
|
||||
this.compiler.minIrArgs = ['-emit-ir'];
|
||||
this.compiler.optPipeline = {
|
||||
arg: ['-Xllvm', '-print-after-all', '-Xllvm', '-print-before-all'],
|
||||
moduleScopeArg: ['-Xllvm', '-print-module-scope'],
|
||||
@@ -53,4 +58,8 @@ export class SwiftCompiler extends BaseCompiler {
|
||||
override isCfgCompiler() {
|
||||
return true;
|
||||
}
|
||||
|
||||
override getIrOutputFilename(inputFilename: string): string {
|
||||
return this.getOutputFilename(path.dirname(inputFilename), this.outputFilebase).replace('.o', '.ll');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user