diff options
author | Michael Lowell Roberts <mirobert@microsoft.com> | 2015-06-12 11:12:35 -0700 |
---|---|---|
committer | Michael Lowell Roberts <mirobert@microsoft.com> | 2015-06-12 11:12:35 -0700 |
commit | a297fb4b9e6c0b915b5bb5bd85050b26a9ed7e3b (patch) | |
tree | 3256ae3d3cdb907b55b52588310f061772e2986a /Source/DafnyDriver | |
parent | 1e9a9af1700f67dde62e8ceb81aa16e13de0e3fb (diff) |
added -optimize option to compiler.
Diffstat (limited to 'Source/DafnyDriver')
-rw-r--r-- | Source/DafnyDriver/DafnyDriver.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/DafnyDriver/DafnyDriver.cs b/Source/DafnyDriver/DafnyDriver.cs index a769b829..cf464754 100644 --- a/Source/DafnyDriver/DafnyDriver.cs +++ b/Source/DafnyDriver/DafnyDriver.cs @@ -15,6 +15,8 @@ namespace Microsoft.Dafny using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
+ using System.Reflection;
+
using Microsoft.Boogie;
using Bpl = Microsoft.Boogie;
@@ -330,7 +332,7 @@ namespace Microsoft.Dafny }
else
{
- var provider = CodeDomProvider.CreateProvider("CSharp");
+ var provider = CodeDomProvider.CreateProvider("CSharp", new Dictionary<string, string> { { "CompilerVersion", "v4.0" } });
var cp = new System.CodeDom.Compiler.CompilerParameters();
cp.GenerateExecutable = hasMain;
if (DafnyOptions.O.RunAfterCompile) {
@@ -344,6 +346,15 @@ namespace Microsoft.Dafny }
cp.CompilerOptions = "/debug /nowarn:0164 /nowarn:0219"; // warning CS0164 complains about unreferenced labels, CS0219 is about unused variables
cp.ReferencedAssemblies.Add("System.Numerics.dll");
+ cp.ReferencedAssemblies.Add("System.Core.dll");
+ cp.ReferencedAssemblies.Add("System.dll");
+
+ if (DafnyOptions.O.Optimize) {
+ var libPath = Path.GetDirectoryName(dafnyProgramName);
+ cp.CompilerOptions += string.Format(" /optimize /define:DAFNY_USE_SYSTEM_COLLECTIONS_IMMUTABLE /lib:{0}", libPath);
+ cp.ReferencedAssemblies.Add("System.Collections.Immutable.dll");
+ cp.ReferencedAssemblies.Add("System.Runtime.dll");
+ }
var cr = provider.CompileAssemblyFromSource(cp, csharpProgram);
var assemblyName = Path.GetFileName(cr.PathToAssembly);
|