| 60 | } |
| 61 | |
| 62 | export class ResolcCompiler extends BaseCompiler { |
| 63 | static get key() { |
| 64 | return 'resolc'; |
| 65 | } |
| 66 | |
| 67 | private readonly pvmAsmParser: PolkaVMAsmParser; |
| 68 | |
| 69 | /** |
| 70 | * @note |
| 71 | * Needs to coincide with the [infrastructure configs](https://github.com/compiler-explorer/infra/blob/main/bin/yaml/solidity.yaml). |
| 72 | */ |
| 73 | static get solcExe() { |
| 74 | return '/opt/compiler-explorer/solc-0.8.30/solc'; |
| 75 | } |
| 76 | |
| 77 | constructor(...args: ConstructorParameters<typeof BaseCompiler>) { |
| 78 | super(...args); |
| 79 | |
| 80 | this.asm = new ResolcRiscVAsmParser(this.compilerProps); |
| 81 | this.pvmAsmParser = new PolkaVMAsmParser(); |
| 82 | |
| 83 | // The arg producing LLVM IR (among other output) is already |
| 84 | // included in optionsForFilter(), but irArg needs to be set. |
| 85 | this.compiler.irArg = []; |
| 86 | this.compiler.supportsIrView = true; |
| 87 | this.compiler.supportsIrViewOptToggleOption = true; |
| 88 | this.compiler.supportsYulView = this.inputIs(InputKind.Solidity); |
| 89 | } |
| 90 | |
| 91 | override getSharedLibraryPathsAsArguments(): string[] { |
| 92 | return []; |
| 93 | } |
| 94 | |
| 95 | override getArgumentParserClass(): typeof BaseParser { |
| 96 | return ResolcParser; |
| 97 | } |
| 98 | |
| 99 | override optionsForFilter(filters: ParseFiltersAndOutputOptions): string[] { |
| 100 | filters.binaryObject = this.reinterpretBinaryObjectFilter(filters.binaryObject); |
| 101 | filters.intel = false; |
| 102 | |
| 103 | const options = ['-g', '--solc', ResolcCompiler.solcExe, '--overwrite', '--debug-output-dir', 'artifacts']; |
| 104 | if (this.inputIs(InputKind.Yul)) { |
| 105 | options.push('--yul'); |
| 106 | } |
| 107 | |
| 108 | return options; |
| 109 | } |
| 110 | |
| 111 | override isCfgCompiler(): boolean { |
| 112 | return false; |
| 113 | } |
| 114 | |
| 115 | override getOutputFilename(dirPath: string): string { |
| 116 | return this.getOutputFilenameWithExtension(dirPath, '.pvmasm'); |
| 117 | } |
| 118 | |
| 119 | override getIrOutputFilename( |
nothing calls this directly
no outgoing calls
no test coverage detected