Mercurial > projects > ldc
comparison gen/functions.cpp @ 632:df196c8dea26
Updated to latest LLVM trunk, function notes have been removed and merged with parameter attributes, which have been renamed to just attributes. Nothing seems to have broke!
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 01 Oct 2008 23:17:14 +0200 |
parents | 26fce59fe80a |
children | 30b42a283c8e |
comparison
equal
deleted
inserted
replaced
629:607b6b5819a7 | 632:df196c8dea26 |
---|---|
130 } | 130 } |
131 else if (isaStruct(at)) { | 131 else if (isaStruct(at)) { |
132 Logger::println("struct param"); | 132 Logger::println("struct param"); |
133 paramvec.push_back(getPtrToType(at)); | 133 paramvec.push_back(getPtrToType(at)); |
134 if (!refOrOut) | 134 if (!refOrOut) |
135 arg->llvmAttrs |= llvm::ParamAttr::ByVal; | 135 arg->llvmAttrs |= llvm::Attribute::ByVal; |
136 } | 136 } |
137 else if (isaArray(at)) { | 137 else if (isaArray(at)) { |
138 // static array are passed by reference | 138 // static array are passed by reference |
139 Logger::println("sarray param"); | 139 Logger::println("sarray param"); |
140 assert(argT->ty == Tsarray); | 140 assert(argT->ty == Tsarray); |
339 else if (f->usesNest) ++llidx; | 339 else if (f->usesNest) ++llidx; |
340 if (f->linkage == LINKd && f->varargs == 1) | 340 if (f->linkage == LINKd && f->varargs == 1) |
341 llidx += 2; | 341 llidx += 2; |
342 | 342 |
343 int funcNumArgs = func->getArgumentList().size(); | 343 int funcNumArgs = func->getArgumentList().size(); |
344 std::vector<llvm::ParamAttrsWithIndex> attrs; | 344 std::vector<llvm::AttributeWithIndex> attrs; |
345 int k = 0; | 345 int k = 0; |
346 | 346 |
347 llvm::ParamAttrsWithIndex PAWI; | 347 llvm::AttributeWithIndex PAWI; |
348 | 348 |
349 // set return value attrs if any | 349 // set return value attrs if any |
350 if (f->retAttrs) | 350 if (f->retAttrs) |
351 { | 351 { |
352 PAWI.Index = 0; | 352 PAWI.Index = 0; |
356 | 356 |
357 // set sret param | 357 // set sret param |
358 if (f->retInPtr) | 358 if (f->retInPtr) |
359 { | 359 { |
360 PAWI.Index = 1; | 360 PAWI.Index = 1; |
361 PAWI.Attrs = llvm::ParamAttr::StructRet; | 361 PAWI.Attrs = llvm::Attribute::StructRet; |
362 attrs.push_back(PAWI); | 362 attrs.push_back(PAWI); |
363 } | 363 } |
364 | 364 |
365 // set byval attrs on implicit main arg | 365 // set byval attrs on implicit main arg |
366 if (fdecl->isMain() && Argument::dim(f->parameters) == 0) | 366 if (fdecl->isMain() && Argument::dim(f->parameters) == 0) |
367 { | 367 { |
368 PAWI.Index = llidx; | 368 PAWI.Index = llidx; |
369 PAWI.Attrs = llvm::ParamAttr::ByVal; | 369 PAWI.Attrs = llvm::Attribute::ByVal; |
370 attrs.push_back(PAWI); | 370 attrs.push_back(PAWI); |
371 llidx++; | 371 llidx++; |
372 } | 372 } |
373 | 373 |
374 // set attrs on the rest of the arguments | 374 // set attrs on the rest of the arguments |
382 | 382 |
383 if (PAWI.Attrs) | 383 if (PAWI.Attrs) |
384 attrs.push_back(PAWI); | 384 attrs.push_back(PAWI); |
385 } | 385 } |
386 | 386 |
387 llvm::PAListPtr palist = llvm::PAListPtr::get(attrs.begin(), attrs.end()); | 387 llvm::AttrListPtr palist = llvm::AttrListPtr::get(attrs.begin(), attrs.end()); |
388 func->setParamAttrs(palist); | 388 func->setAttributes(palist); |
389 } | 389 } |
390 | 390 |
391 ////////////////////////////////////////////////////////////////////////////////////////// | 391 ////////////////////////////////////////////////////////////////////////////////////////// |
392 | 392 |
393 void DtoDeclareFunction(FuncDeclaration* fdecl) | 393 void DtoDeclareFunction(FuncDeclaration* fdecl) |