Mercurial > projects > ldc
comparison gen/toobj.cpp @ 217:0806379a5eca trunk
[svn r233] Added: -oq command line option for writing fully qualified object names.
Added: started support for x86 80bit floating point.
Changed: aggregates passed by value now use the llvm 'byval' parameter attribute, also lays ground work for
using other attributes.
Changed: eliminated a lot more std::vectorS, these showed up pretty much at the top when profiling!
Changed: performed other misc. cleanups.
Changed: halt expression now call the new llvm trap intrinsic instead of an assert(0).
Changed: dstress suite now passes -O0 by default, this only eliminates unreferenced globals, which speeds up
linking quite a bit.
author | lindquist |
---|---|
date | Thu, 05 Jun 2008 06:38:36 +0200 |
parents | 7816aafeea3c |
children | 9760f54af0b7 |
comparison
equal
deleted
inserted
replaced
216:3d022aa016ae | 217:0806379a5eca |
---|---|
14 #include "gen/llvm.h" | 14 #include "gen/llvm.h" |
15 #include "llvm/Analysis/Verifier.h" | 15 #include "llvm/Analysis/Verifier.h" |
16 #include "llvm/Bitcode/ReaderWriter.h" | 16 #include "llvm/Bitcode/ReaderWriter.h" |
17 #include "llvm/Target/TargetMachine.h" | 17 #include "llvm/Target/TargetMachine.h" |
18 #include "llvm/Target/TargetMachineRegistry.h" | 18 #include "llvm/Target/TargetMachineRegistry.h" |
19 #include "llvm/System/Path.h" | |
19 | 20 |
20 #include "mars.h" | 21 #include "mars.h" |
21 #include "module.h" | 22 #include "module.h" |
22 #include "mtype.h" | 23 #include "mtype.h" |
23 #include "declaration.h" | 24 #include "declaration.h" |
149 } | 150 } |
150 | 151 |
151 // run optimizer | 152 // run optimizer |
152 llvmdc_optimize_module(ir.module, global.params.optimizeLevel, global.params.llvmInline); | 153 llvmdc_optimize_module(ir.module, global.params.optimizeLevel, global.params.llvmInline); |
153 | 154 |
155 // eventually do our own path stuff, dmd's is a bit strange. | |
156 typedef llvm::sys::Path LLPath; | |
157 LLPath bcpath; | |
158 LLPath llpath; | |
159 | |
160 if (global.params.fqnPaths) | |
161 { | |
162 bcpath = LLPath(md->toChars()); | |
163 bcpath.appendSuffix("bc"); | |
164 | |
165 llpath = LLPath(md->toChars()); | |
166 llpath.appendSuffix("ll"); | |
167 } | |
168 else | |
169 { | |
170 bcpath = LLPath(bcfile->name->toChars()); | |
171 llpath = LLPath(llfile->name->toChars()); | |
172 } | |
173 | |
154 // write bytecode | 174 // write bytecode |
155 { | 175 { |
156 Logger::println("Writing LLVM bitcode\n"); | 176 Logger::println("Writing LLVM bitcode\n"); |
157 std::ofstream bos(bcfile->name->toChars(), std::ios::binary); | 177 std::ofstream bos(bcpath.c_str(), std::ios::binary); |
158 llvm::WriteBitcodeToFile(ir.module, bos); | 178 llvm::WriteBitcodeToFile(ir.module, bos); |
159 } | 179 } |
160 | 180 |
161 // disassemble ? | 181 // disassemble ? |
162 if (global.params.disassemble) { | 182 if (global.params.disassemble) { |
163 Logger::println("Writing LLVM asm to: %s\n", llfile->name->toChars()); | 183 Logger::println("Writing LLVM asm to: %s\n", llfile->name->toChars()); |
164 std::ofstream aos(llfile->name->toChars()); | 184 std::ofstream aos(llpath.c_str()); |
165 ir.module->print(aos); | 185 ir.module->print(aos); |
166 } | 186 } |
167 | 187 |
168 delete ir.module; | 188 delete ir.module; |
169 gTargetData = 0; | 189 gTargetData = 0; |