aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/clang.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compilers/clang.js')
-rw-r--r--lib/compilers/clang.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/compilers/clang.js b/lib/compilers/clang.js
index 6c2bacb60..fa197d026 100644
--- a/lib/compilers/clang.js
+++ b/lib/compilers/clang.js
@@ -24,6 +24,7 @@
import path from 'path';
+import { SassAsmParser } from '../asm-parser-sass';
import { BaseCompiler } from '../base-compiler';
export class ClangCompiler extends BaseCompiler {
@@ -39,3 +40,31 @@ export class ClangCompiler extends BaseCompiler {
return super.runCompiler(compiler, options, inputFilename, execOptions);
}
}
+
+export class ClangCudaCompiler extends ClangCompiler {
+ static get key() { return 'clang-cuda'; }
+ constructor(info, env) {
+ super(info, env);
+
+ this.asm = new SassAsmParser();
+ }
+
+ optionsForFilter(filters, outputFilename) {
+ return ['-o', this.filename(outputFilename), '-g1', filters.binary ? '-c' : '-S'];
+ }
+
+ async objdump(outputFilename, result, maxSize) {
+ // For nvdisasm.
+ const args = [outputFilename, '-c', '-g', '-hex'];
+ const execOptions = {maxOutput: maxSize, customCwd: path.dirname(outputFilename)};
+
+ const objResult = await this.exec(this.compiler.objdumper, args, execOptions);
+ result.asm = objResult.stdout;
+ if (objResult.code !== 0) {
+ result.asm = `<No output: nvdisasm returned ${objResult.code}>`;
+ } else {
+ result.objdumpTime = objResult.execTime;
+ }
+ return result;
+ }
+}