mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-27 09:03:15 +01:00
[svn r112] Fixed 'case 1,2,3:' style case statements.
Fixed a bunch of bugs with return/break/continue in loops. Fixed support for the DMDFE hidden implicit return value variable. This can be needed for some foreach statements where the loop body is converted to a nested delegate, but also possibly returns from the function. Added std.math to phobos. Added AA runtime support code, done ground work for implementing AAs. Several other bugfixes.
This commit is contained in:
@@ -378,6 +378,8 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
}
|
||||
if (f->llvmUsesThis) {
|
||||
iarg->setName("this");
|
||||
fdecl->llvmThisVar = iarg;
|
||||
assert(fdecl->llvmThisVar);
|
||||
++iarg;
|
||||
}
|
||||
int varargs = -1;
|
||||
@@ -426,6 +428,8 @@ void DtoDefineFunc(FuncDeclaration* fd)
|
||||
if (fd->llvmDefined) return;
|
||||
fd->llvmDefined = true;
|
||||
|
||||
assert(fd->llvmDeclared);
|
||||
|
||||
Logger::println("DtoDefineFunc(%s)", fd->toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
@@ -474,6 +478,7 @@ void DtoDefineFunc(FuncDeclaration* fd)
|
||||
assert(fd->llvmIRFunc);
|
||||
gIR->functions.push_back(fd->llvmIRFunc);
|
||||
|
||||
/* // moved to declaration
|
||||
// this handling
|
||||
if (f->llvmUsesThis) {
|
||||
Logger::println("uses this");
|
||||
@@ -483,6 +488,7 @@ void DtoDefineFunc(FuncDeclaration* fd)
|
||||
fd->llvmThisVar = func->arg_begin();
|
||||
assert(fd->llvmThisVar != 0);
|
||||
}
|
||||
*/
|
||||
|
||||
if (fd->isMain())
|
||||
gIR->emitMain = true;
|
||||
@@ -497,6 +503,12 @@ void DtoDefineFunc(FuncDeclaration* fd)
|
||||
f->llvmAllocaPoint = new llvm::BitCastInst(llvm::ConstantInt::get(llvm::Type::Int32Ty,0,false),llvm::Type::Int32Ty,"alloca point",gIR->scopebb());
|
||||
gIR->func()->allocapoint = f->llvmAllocaPoint;
|
||||
|
||||
// need result variable? (not nested)
|
||||
if (fd->vresult && !fd->vresult->nestedref) {
|
||||
Logger::println("non-nested vresult value");
|
||||
fd->vresult->llvmValue = new llvm::AllocaInst(DtoType(fd->vresult->type),"function_vresult",f->llvmAllocaPoint);
|
||||
}
|
||||
|
||||
// give arguments storage
|
||||
size_t n = Argument::dim(f->parameters);
|
||||
for (int i=0; i < n; ++i) {
|
||||
@@ -524,7 +536,14 @@ void DtoDefineFunc(FuncDeclaration* fd)
|
||||
|
||||
llvm::Value* parentNested = NULL;
|
||||
if (FuncDeclaration* fd2 = fd->toParent()->isFuncDeclaration()) {
|
||||
parentNested = fd2->llvmNested;
|
||||
if (!fd->isStatic())
|
||||
parentNested = fd2->llvmNested;
|
||||
}
|
||||
|
||||
// need result variable? (nested)
|
||||
if (fd->vresult && fd->vresult->nestedref) {
|
||||
Logger::println("nested vresult value: %s", fd->vresult->toChars());
|
||||
fd->llvmNestedVars.insert(fd->vresult);
|
||||
}
|
||||
|
||||
// construct nested variables struct
|
||||
|
||||
Reference in New Issue
Block a user