changeset 1276:fa20726fe074

Update codegen to (hopefully) work correctly with newer LLVM trunk, where there's no longer a Fast flag. (It has been replaced by an optimization level) Untested because I haven't compiled that recent an LLVM yet :).
author Frits van Bommel <fvbommel wxs.nl>
date Wed, 29 Apr 2009 10:26:28 +0200
parents bedf0bfb8fdb
children 6bd5ce91b136
files gen/toobj.cpp
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gen/toobj.cpp	Tue Apr 28 21:58:06 2009 +0200
+++ b/gen/toobj.cpp	Wed Apr 29 10:26:28 2009 +0200
@@ -50,6 +50,7 @@
 #include "gen/abi.h"
 #include "gen/cl_options.h"
 #include "gen/optimizer.h"
+#include "gen/llvm-version.h"
 
 #include "ir/irvar.h"
 #include "ir/irmodule.h"
@@ -263,12 +264,19 @@
     // Ask the target to add backend passes as necessary.
     MachineCodeEmitter *MCE = 0;
 
+#if LLVM_REV < 70343
+    // Last argument is bool Fast
     // debug info doesn't work properly without fast!
-    bool Fast = !optimize() || global.params.symdebug;
-    FileModel::Model mod = Target.addPassesToEmitFile(Passes, out, TargetMachine::AssemblyFile, Fast);
+    bool LastArg = !optimize() || global.params.symdebug;
+#else
+    // Last argument is unsigned OptLevel
+    // debug info doesn't work properly with OptLevel > 0!
+    unsigned LastArg = global.params.symdebug ? 0 : optLevel();
+#endif
+    FileModel::Model mod = Target.addPassesToEmitFile(Passes, out, TargetMachine::AssemblyFile, LastArg);
     assert(mod == FileModel::AsmFile);
 
-    bool err = Target.addPassesToEmitFileFinish(Passes, MCE, Fast);
+    bool err = Target.addPassesToEmitFileFinish(Passes, MCE, LastArg);
     assert(!err);
 
     Passes.doInitialization();