Mercurial > projects > ldc
comparison gen/toobj.c @ 57:a9d29e9f1fed trunk
[svn r61] Added support for D-style variadic functions :)
author | lindquist |
---|---|
date | Thu, 25 Oct 2007 02:39:53 +0200 |
parents | 0ccfae271c45 |
children | 2c3cd3596187 |
comparison
equal
deleted
inserted
replaced
56:3a784f7790d6 | 57:a9d29e9f1fed |
---|---|
776 llvm::Value* ptr = gIR->ir->CreateBitCast(llvmThisVar, parentNested->getType(), "tmp"); | 776 llvm::Value* ptr = gIR->ir->CreateBitCast(llvmThisVar, parentNested->getType(), "tmp"); |
777 gIR->ir->CreateStore(ptr, LLVM_DtoGEPi(llvmNested, 0,0, "tmp")); | 777 gIR->ir->CreateStore(ptr, LLVM_DtoGEPi(llvmNested, 0,0, "tmp")); |
778 } | 778 } |
779 } | 779 } |
780 | 780 |
781 // copy _argptr to a memory location | |
782 if (f->linkage == LINKd && f->varargs == 1) | |
783 { | |
784 llvm::Value* argptrmem = new llvm::AllocaInst(llvmArgPtr->getType(), "_argptrmem", gIR->topallocapoint()); | |
785 new llvm::StoreInst(llvmArgPtr, argptrmem, gIR->scopebb()); | |
786 llvmArgPtr = argptrmem; | |
787 } | |
788 | |
781 // output function body | 789 // output function body |
782 fbody->toIR(gIR); | 790 fbody->toIR(gIR); |
783 | 791 |
784 // llvm requires all basic blocks to end with a TerminatorInst but DMD does not put a return statement | 792 // llvm requires all basic blocks to end with a TerminatorInst but DMD does not put a return statement |
785 // in automatically, so we do it here. | 793 // in automatically, so we do it here. |