comparison gen/functions.cpp @ 378:d8234836b40f

Get rid of runTimeHack and instead add proper argument info to the frontend declatation.
author Christian Kamm <kamm incasoftware de>
date Tue, 22 Jul 2008 19:24:40 +0200
parents 4d7495038ae8
children d632801b15f0
comparison
equal deleted inserted replaced
377:4731f3eed1f0 378:d8234836b40f
285 fdecl->ir.resolved = true; 285 fdecl->ir.resolved = true;
286 286
287 Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars()); 287 Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars());
288 LOG_SCOPE; 288 LOG_SCOPE;
289 289
290 if (fdecl->runTimeHack) {
291 gIR->declareList.push_back(fdecl);
292 TypeFunction* tf = (TypeFunction*)fdecl->type;
293 tf->llvmRetInPtr = DtoIsPassedByRef(tf->next);
294 return;
295 }
296
297 if (fdecl->parent) 290 if (fdecl->parent)
298 if (TemplateInstance* tinst = fdecl->parent->isTemplateInstance()) 291 if (TemplateInstance* tinst = fdecl->parent->isTemplateInstance())
299 { 292 {
300 TemplateDeclaration* tempdecl = tinst->tempdecl; 293 TemplateDeclaration* tempdecl = tinst->tempdecl;
301 if (tempdecl->llvmInternal == LLVMva_arg) 294 if (tempdecl->llvmInternal == LLVMva_arg)
389 382
390 // get TypeFunction* 383 // get TypeFunction*
391 Type* t = DtoDType(fdecl->type); 384 Type* t = DtoDType(fdecl->type);
392 TypeFunction* f = (TypeFunction*)t; 385 TypeFunction* f = (TypeFunction*)t;
393 386
394 // runtime function special handling
395 if (fdecl->runTimeHack) {
396 Logger::println("runtime hack func chars: %s", fdecl->toChars());
397 if (!fdecl->ir.irFunc) {
398 IrFunction* irfunc = new IrFunction(fdecl);
399 llvm::Function* llfunc = LLVM_D_GetRuntimeFunction(gIR->module, fdecl->toChars());
400 fdecl->ir.irFunc = irfunc;
401 fdecl->ir.irFunc->func = llfunc;
402 }
403 return;
404 }
405
406 bool declareOnly = false; 387 bool declareOnly = false;
407 bool templInst = fdecl->parent && DtoIsTemplateInstance(fdecl->parent); 388 bool templInst = fdecl->parent && DtoIsTemplateInstance(fdecl->parent);
408 if (!templInst && fdecl->getModule() != gIR->dmodule) 389 if (!templInst && fdecl->getModule() != gIR->dmodule)
409 { 390 {
410 Logger::println("not template instance, and not in this module. declare only!"); 391 Logger::println("not template instance, and not in this module. declare only!");
411 Logger::println("current module: %s", gIR->dmodule->ident->toChars()); 392 Logger::println("current module: %s", gIR->dmodule->ident->toChars());
412 Logger::println("func module: %s", fdecl->getModule()->ident->toChars()); 393 if(fdecl->getModule())
394 Logger::println("func module: %s", fdecl->getModule()->ident->toChars());
395 else
396 Logger::println("func not in a module, probably runtime");
413 declareOnly = true; 397 declareOnly = true;
414 } 398 }
415 else if (fdecl->llvmInternal == LLVMva_start) 399 else if (fdecl->llvmInternal == LLVMva_start)
416 declareOnly = true; 400 declareOnly = true;
417 401