Mercurial > projects > ldc
comparison gen/tollvm.cpp @ 93:08508eebbb3e trunk
[svn r97] Fixed bug with main(string[] args) on 32 bit systems. 64bit worked.
author | lindquist |
---|---|
date | Thu, 08 Nov 2007 19:21:05 +0100 |
parents | 70d6113eeb8c |
children | 61615fa85940 |
comparison
equal
deleted
inserted
replaced
92:70d6113eeb8c | 93:08508eebbb3e |
---|---|
678 | 678 |
679 const llvm::Type* at = mainty->getParamType(0)->getContainedType(0); | 679 const llvm::Type* at = mainty->getParamType(0)->getContainedType(0); |
680 llvm::Value* arr = new llvm::AllocaInst(at->getContainedType(1)->getContainedType(0), func->arg_begin(), "argstorage", apt); | 680 llvm::Value* arr = new llvm::AllocaInst(at->getContainedType(1)->getContainedType(0), func->arg_begin(), "argstorage", apt); |
681 llvm::Value* a = new llvm::AllocaInst(at, "argarray", apt); | 681 llvm::Value* a = new llvm::AllocaInst(at, "argarray", apt); |
682 llvm::Value* ptr = DtoGEPi(a,0,0,"tmp",bb); | 682 llvm::Value* ptr = DtoGEPi(a,0,0,"tmp",bb); |
683 llvm::Value* v = new llvm::ZExtInst(args[0], DtoSize_t(), "tmp", bb); | 683 llvm::Value* v = args[0]; |
684 if (v->getType() != DtoSize_t()) | |
685 v = new llvm::ZExtInst(v, DtoSize_t(), "tmp", bb); | |
684 new llvm::StoreInst(v,ptr,bb); | 686 new llvm::StoreInst(v,ptr,bb); |
685 ptr = DtoGEPi(a,0,1,"tmp",bb); | 687 ptr = DtoGEPi(a,0,1,"tmp",bb); |
686 new llvm::StoreInst(arr,ptr,bb); | 688 new llvm::StoreInst(arr,ptr,bb); |
687 args.push_back(a); | 689 args.push_back(a); |
688 new llvm::CallInst(mfn, args.begin(), args.end(), "", bb); | 690 new llvm::CallInst(mfn, args.begin(), args.end(), "", bb); |