comparison gen/main.cpp @ 1147:dbe4af57b240

Changed use of toObjFile to a new codegen method. More versioning of DMD specific codegen code.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Fri, 27 Mar 2009 17:54:27 +0100
parents b30fe7e1dbb9
children 5ebe8224988b
comparison
equal deleted inserted replaced
1146:1860414bf3b7 1147:dbe4af57b240
360 fatal(); 360 fatal();
361 } 361 }
362 } 362 }
363 363
364 // create a proper target 364 // create a proper target
365 Ir ir;
365 366
366 // check -m32/64 sanity 367 // check -m32/64 sanity
367 if (m32bits && m64bits) 368 if (m32bits && m64bits)
368 error("cannot use both -m32 and -m64 options"); 369 error("cannot use both -m32 and -m64 options");
369 else if ((m32bits || m64bits) && (mArch != 0 || !mTargetTriple.empty())) 370 else if ((m32bits || m64bits) && (mArch != 0 || !mTargetTriple.empty()))
560 if (global.params.useUnitTests) 561 if (global.params.useUnitTests)
561 VersionCondition::addPredefinedGlobalIdent("unittest"); 562 VersionCondition::addPredefinedGlobalIdent("unittest");
562 #endif 563 #endif
563 564
564 // Initialization 565 // Initialization
565 Type::init(); 566 Type::init(&ir);
566 Id::initialize(); 567 Id::initialize();
567 Module::init(); 568 Module::init();
568 initPrecedence(); 569 initPrecedence();
569 570
570 backend_init(); 571 backend_init();
830 m = (Module *)modules.data[i]; 831 m = (Module *)modules.data[i];
831 if (global.params.verbose) 832 if (global.params.verbose)
832 printf("code %s\n", m->toChars()); 833 printf("code %s\n", m->toChars());
833 if (global.params.obj) 834 if (global.params.obj)
834 { 835 {
835 llvm::Module* lm = m->genLLVMModule(0); 836 llvm::Module* lm = m->genLLVMModule(&ir);
836 if (!singleObj) 837 if (!singleObj)
837 { 838 {
838 m->deleteObjFile(); 839 m->deleteObjFile();
839 writeModule(lm, m->objfile->name->str); 840 writeModule(lm, m->objfile->name->str);
840 global.params.objfiles->push(m->objfile->name->str); 841 global.params.objfiles->push(m->objfile->name->str);