Mercurial > projects > ldc
comparison gen/arrays.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 | 93433f4b6963 |
comparison
equal
deleted
inserted
replaced
629:607b6b5819a7 | 632:df196c8dea26 |
---|---|
756 } | 756 } |
757 | 757 |
758 CallOrInvoke* call = gIR->CreateCallOrInvoke(fn, args.begin(), args.end(), "tmp"); | 758 CallOrInvoke* call = gIR->CreateCallOrInvoke(fn, args.begin(), args.end(), "tmp"); |
759 | 759 |
760 // set param attrs | 760 // set param attrs |
761 llvm::PAListPtr palist; | 761 llvm::AttrListPtr palist; |
762 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); | 762 palist = palist.addAttr(1, llvm::Attribute::ByVal); |
763 palist = palist.addAttr(2, llvm::ParamAttr::ByVal); | 763 palist = palist.addAttr(2, llvm::Attribute::ByVal); |
764 call->setParamAttrs(palist); | 764 call->setAttributes(palist); |
765 | 765 |
766 return call->get(); | 766 return call->get(); |
767 } | 767 } |
768 | 768 |
769 ////////////////////////////////////////////////////////////////////////////////////////// | 769 ////////////////////////////////////////////////////////////////////////////////////////// |
1070 // set up failbb to call the array bounds error runtime function | 1070 // set up failbb to call the array bounds error runtime function |
1071 | 1071 |
1072 gIR->scope() = IRScope(failbb, okbb); | 1072 gIR->scope() = IRScope(failbb, okbb); |
1073 | 1073 |
1074 std::vector<LLValue*> args; | 1074 std::vector<LLValue*> args; |
1075 llvm::PAListPtr palist; | 1075 llvm::AttrListPtr palist; |
1076 | 1076 |
1077 // file param | 1077 // file param |
1078 // FIXME: every array bounds check creates a global for the filename !!! | 1078 // FIXME: every array bounds check creates a global for the filename !!! |
1079 LLConstant* c = DtoConstString(loc.filename); | 1079 LLConstant* c = DtoConstString(loc.filename); |
1080 | 1080 |
1088 DtoStore(c->getOperand(0), ptr); | 1088 DtoStore(c->getOperand(0), ptr); |
1089 ptr = DtoGEPi(alloc, 0,1, "tmp"); | 1089 ptr = DtoGEPi(alloc, 0,1, "tmp"); |
1090 DtoStore(c->getOperand(1), ptr); | 1090 DtoStore(c->getOperand(1), ptr); |
1091 | 1091 |
1092 args.push_back(alloc); | 1092 args.push_back(alloc); |
1093 palist = palist.addAttr(1, llvm::ParamAttr::ByVal); | 1093 palist = palist.addAttr(1, llvm::Attribute::ByVal); |
1094 | 1094 |
1095 // line param | 1095 // line param |
1096 c = DtoConstUint(loc.linnum); | 1096 c = DtoConstUint(loc.linnum); |
1097 args.push_back(c); | 1097 args.push_back(c); |
1098 | 1098 |
1099 // call | 1099 // call |
1100 llvm::Function* errorfn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_array_bounds"); | 1100 llvm::Function* errorfn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_array_bounds"); |
1101 CallOrInvoke* call = gIR->CreateCallOrInvoke(errorfn, args.begin(), args.end()); | 1101 CallOrInvoke* call = gIR->CreateCallOrInvoke(errorfn, args.begin(), args.end()); |
1102 call->setParamAttrs(palist); | 1102 call->setAttributes(palist); |
1103 | 1103 |
1104 // the function does not return | 1104 // the function does not return |
1105 gIR->ir->CreateUnreachable(); | 1105 gIR->ir->CreateUnreachable(); |
1106 | 1106 |
1107 | 1107 |