Skip to content

Commit

Permalink
Allow configuration of the 'Intel Syntax' per-compiler. Configure sam…
Browse files Browse the repository at this point in the history
…e for clang and icc
  • Loading branch information
mattgodbolt committed Mar 11, 2015
1 parent 5d707a5 commit 400e553
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 15 deletions.
13 changes: 9 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ function configuredCompilers() {
name: props.get("gcc-explorer", base + ".name", name),
alias: props.get("gcc-explorer", base + ".alias"),
versionFlag: props.get("gcc-explorer", base + ".versionFlag"),
is6g: !!props.get("gcc-explorer", base + ".is6g", false)
is6g: !!props.get("gcc-explorer", base + ".is6g", false),
intelAsm: props.get("gcc-explorer", base + ".intelAsm", "")
});
}));
}
Expand All @@ -237,7 +238,10 @@ function getCompilerInfo(compilerInfo) {
var versionFlag = compilerInfo.versionFlag || '--version';
child_process.exec(compiler + ' ' + versionFlag, function (err, output) {
if (err) return resolve(null);
var version = output.split('\n')[0];
compilerInfo.version = output.split('\n')[0];
if (compilerInfo.intelAsm) {
return resolve(compilerInfo);
}
child_process.exec(compiler + ' --target-help', function (err, output) {
var options = {};
if (!err) {
Expand All @@ -248,8 +252,9 @@ function getCompilerInfo(compilerInfo) {
options[match[0]] = true;
});
}
compilerInfo.version = version;
compilerInfo.supportedOpts = options;
if (options['-masm']) {
compilerInfo.intelAsm="-masm=intel";
}
resolve(compilerInfo);
});
});
Expand Down
4 changes: 4 additions & 0 deletions etc/config/gcc-explorer.amazon.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ compiler.g482.exe=/usr/bin/g++-4.8
compiler.g482.name=x86 gcc 4.8.2
compiler.clang350.exe=/usr/bin/clang++-3.5
compiler.clang350.name=x86 clang 3.5.0
compiler.clang350.intelAsm=-masm=intel
compiler.clang351.exe=/opt/clang+llvm-3.5.1-x86_64-linux-gnu/bin/clang++
compiler.clang351.name=x86 clang 3.5.1
compiler.clang351.intelAsm=-masm=intel
compiler.clang36x.exe=/usr/bin/clang++-3.6
compiler.clang36x.name=x86 clang 3.6 (rc2)
compiler.clang36x.intelAsm=-masm=intel
compiler.clang37x.exe=/usr/bin/clang++-3.7
compiler.clang37x.name=x86 clang 3.7 (experimental)
compiler.clang37x.intelAsm=-masm=intel

###############################
# GCC for ppc
Expand Down
5 changes: 5 additions & 0 deletions etc/config/gcc-explorer.amazon1204.properties
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,24 @@ compiler.g490c2.name=x86 gcc 4.9.0 (w/concepts)
compiler.icc1301.exe=/opt/intel/bin/icc
compiler.icc1301.alias=/opt/intel/bin/icc
compiler.icc1301.name=x86 icc 13.0.1
compiler.icc1301.intelAsm=-masm=intel
# Clang for x86
compiler.clang30.exe=/usr/bin/clang++
compiler.clang30.alias=/usr/bin/clang++
compiler.clang30.name=x86 clang 3.0
compiler.clang30.intelAsm=-mllvm --x86-asm-syntax=intel
compiler.clang32.exe=/opt/clang-3.2/bin/clang++
compiler.clang32.alias=/opt/clang-3.2/bin/clang++
compiler.clang32.name=x86 clang 3.2
compiler.clang32.intelAsm=-mllvm --x86-asm-syntax=intel
compiler.clang33.exe=/opt/clang-3.3/bin/clang++
compiler.clang33.alias=/opt/clang-3.3/bin/clang++
compiler.clang33.name=x86 clang 3.3
compiler.clang33.intelAsm=-mllvm --x86-asm-syntax=intel
compiler.clang341.exe=/opt/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin/clang++
compiler.clang341.alias=/opt/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin/clang++
compiler.clang341.name=x86 clang 3.4.1
compiler.clang341.intelAsm=-mllvm --x86-asm-syntax=intel

###############################
# GCC for ARM
Expand Down
14 changes: 8 additions & 6 deletions etc/config/gcc-explorer.lud-ldnmg01.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#port=10240
compileTimeoutMs=5000
defaultCompiler=g46
#compilers=g44:g45:g46:clang34
compilers=go:6g
language=go
compileFilename=file.go
compilers=g44:g45:g46:clang35
#compilers=go:6g
#language=go
#compileFilename=file.go
compiler.go.exe=/usr/bin/gccgo
compiler.go.name=GCC go
compiler.6g.exe=/home/mgodbolt/build/go/pkg/tool/linux_amd64/6g
Expand All @@ -21,8 +21,10 @@ compiler.g45.alias=/usr/bin/g++-4.5
compiler.g46.exe=/usr/bin/g++-4.6
compiler.g46.name=g++ 4.6
compiler.g46.alias=/usr/bin/g++-4.6
compiler.clang34.exe=/usr/bin/clang++-3.4
compiler.clang34.name=Clang 4.6
compiler.clang35.exe=/usr/bin/clang++-3.5
compiler.clang35.name=Clang 3.5
#compiler.clang35.intelAsm=-masm=intel
compiler.clang35.intelAsm=-mllvm --x86-asm-syntax=intel
#compilers=/usr/bin/g++-4.4:/usr/bin/g++-4.5:/usr/bin/g++-4.6:/usr/bin/g++-4.7:/usr/bin/clang++:/home/mgodbolt/apps/intel-icc-oss/bin/icc:/site/apps/gcc-4.7.2-drw.patched.6/bin/g++:/site/apps/gcc-4.8.0-drw.1/bin/g++
#compiler-wrapper=./c-preload/compiler-wrapper
#compilers=/usr/bin/gdc:/usr/bin/gdc-4.4:/usr/bin/gdc-4.6
Expand Down
6 changes: 2 additions & 4 deletions lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,8 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
var dirPath = info.dirPath;
var postProcess = props.get("gcc-explorer", "postProcess");
var outputFilename = path.join(dirPath, 'output.S');
if (compilerInfo.supportedOpts['-masm']) {
var syntax = '-masm=att'; // default at&t
if (filters.intel) syntax = '-masm=intel';
options = options.concat([syntax]);
if (compilerInfo.intelAsm && filters.intel) {
options = options.concat(compilerInfo.intelAsm.split(" "));
}
var compileToAsm = props.get("gcc-explorer", "compileToAsm", "-S").split(" ");
options = options.concat(['-g', '-o', outputFilename]).concat(compileToAsm).concat([inputFilename]);
Expand Down
2 changes: 1 addition & 1 deletion static/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback, lan
var compiler = compilersById[$('.compiler').val()];
if (compiler === undefined)
return;
domRoot.find('.filter button.btn[value="intel"]').toggleClass("disabled", !compiler.supportedOpts["-masm"]);
domRoot.find('.filter button.btn[value="intel"]').toggleClass("disabled", !compiler.intelAsm);
$(".compilerVersion").text(compiler.name + " (" + compiler.version + ")");
}

Expand Down

0 comments on commit 400e553

Please sign in to comment.