# HG changeset patch # User Frits van Bommel # Date 1240993588 -7200 # Node ID fa20726fe074f949e5c15b43d895337cea3a8501 # Parent bedf0bfb8fdbddff2db629873c725fb4ebfb1835 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 :). diff -r bedf0bfb8fdb -r fa20726fe074 gen/toobj.cpp --- 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();