RewriterVar* JitFragmentWriter::emitCreateSet(const llvm::ArrayRef<RewriterVar*> values) { auto num = values.size(); if (num == 0) return call(false, (void*)createSet); else return call(false, (void*)createSetHelper, imm(num), allocArgs(values)); }
RewriterVar* JitFragmentWriter::emitCreateDict(const llvm::ArrayRef<RewriterVar*> keys, const llvm::ArrayRef<RewriterVar*> values) { assert(keys.size() == values.size()); if (keys.empty()) return call(false, (void*)createDict); else return call(false, (void*)createDictHelper, imm(keys.size()), allocArgs(keys), allocArgs(values)); }
RewriterVar* JitFragmentWriter::emitCallattr(AST_expr* node, RewriterVar* obj, BoxedString* attr, CallattrFlags flags, const llvm::ArrayRef<RewriterVar*> args, std::vector<BoxedString*>* keyword_names) { TypeRecorder* type_recorder = getTypeRecorderForNode(node); #if ENABLE_BASELINEJIT_ICS RewriterVar* attr_var = imm(attr); RewriterVar* flags_var = imm(flags.asInt()); RewriterVar::SmallVector call_args; call_args.push_back(obj); call_args.push_back(attr_var); call_args.push_back(flags_var); call_args.push_back(args.size() > 0 ? args[0] : imm(0ul)); call_args.push_back(args.size() > 1 ? args[1] : imm(0ul)); call_args.push_back(args.size() > 2 ? args[2] : imm(0ul)); if (args.size() > 3) { RewriterVar* scratch = allocate(args.size() - 3); for (int i = 0; i < args.size() - 3; ++i) scratch->setAttr(i * sizeof(void*), args[i + 3]); call_args.push_back(scratch); } else if (keyword_names) { call_args.push_back(imm(0ul)); } if (keyword_names) call_args.push_back(imm(keyword_names)); return emitPPCall((void*)callattr, call_args, 2, 640, type_recorder); #else // We could make this faster but for now: keep it simple, stupid... RewriterVar* attr_var = imm(attr); RewriterVar* flags_var = imm(flags.asInt()); RewriterVar* keyword_names_var = keyword_names ? imm(keyword_names) : nullptr; RewriterVar* args_array = nullptr; if (args.size()) args_array = allocArgs(args); else RELEASE_ASSERT(!keyword_names_var, "0 args but keyword names are set"); RewriterVar::SmallVector call_args; call_args.push_back(obj); call_args.push_back(attr_var); call_args.push_back(flags_var); call_args.push_back(imm(type_recorder)); if (args_array) call_args.push_back(args_array); if (keyword_names_var) call_args.push_back(keyword_names_var); return call(false, (void*)callattrHelper, call_args); #endif }
RewriterVar* JitFragmentWriter::emitCreateTuple(const llvm::ArrayRef<RewriterVar*> values) { auto num = values.size(); if (num == 0) return imm(EmptyTuple); else if (num == 1) return call(false, (void*)BoxedTuple::create1, values[0]); else if (num == 2) return call(false, (void*)BoxedTuple::create2, values[0], values[1]); else if (num == 3) return call(false, (void*)BoxedTuple::create3, values[0], values[1], values[2]); else return call(false, (void*)createTupleHelper, imm(num), allocArgs(values)); }
RewriterVar* JitFragmentWriter::emitRuntimeCall(AST_expr* node, RewriterVar* obj, ArgPassSpec argspec, const llvm::ArrayRef<RewriterVar*> args, std::vector<BoxedString*>* keyword_names) { TypeRecorder* type_recorder = getTypeRecorderForNode(node); #if ENABLE_BASELINEJIT_ICS RewriterVar* argspec_var = imm(argspec.asInt()); RewriterVar::SmallVector call_args; call_args.push_back(obj); call_args.push_back(argspec_var); call_args.push_back(args.size() > 0 ? args[0] : imm(0ul)); call_args.push_back(args.size() > 1 ? args[1] : imm(0ul)); call_args.push_back(args.size() > 2 ? args[2] : imm(0ul)); if (args.size() > 3) { RewriterVar* scratch = allocate(args.size() - 3); for (int i = 0; i < args.size() - 3; ++i) scratch->setAttr(i * sizeof(void*), args[i + 3]); call_args.push_back(scratch); } else call_args.push_back(imm(0ul)); if (keyword_names) call_args.push_back(imm(keyword_names)); return emitPPCall((void*)runtimeCall, call_args, 2, 640, type_recorder); #else RewriterVar* argspec_var = imm(argspec.asInt()); RewriterVar* keyword_names_var = keyword_names ? imm(keyword_names) : nullptr; RewriterVar* args_array = nullptr; if (args.size()) { args_array = allocArgs(args); } else RELEASE_ASSERT(!keyword_names_var, "0 args but keyword names are set"); RewriterVar::SmallVector call_args; call_args.push_back(obj); call_args.push_back(argspec_var); call_args.push_back(imm(type_recorder)); if (args_array) call_args.push_back(args_array); if (keyword_names_var) call_args.push_back(keyword_names_var); return call(false, (void*)runtimeCallHelper, call_args); #endif }
//read program parameters args *getArgsBambi(argStruct *arguments){ args *ret = allocArgs(); ret->inputfiles=angsd::getArg("-bam",ret->inputfiles,arguments); ret->inputfile=angsd::getArg("-i",ret->inputfile,arguments); if(ret->inputfiles==NULL && ret->inputfile==NULL) return NULL; if(ret->inputfiles!=NULL&&strcmp(ret->inputfiles,"-999")==0){//DRAGON fix this ret->inputfiles=NULL; printArg(stdout,ret); exit(0); } remove_bads = angsd::getArg("-remove_bads",remove_bads,arguments); uniqueOnly = angsd::getArg("-uniqueOnly",uniqueOnly,arguments); only_proper_pairs =angsd::getArg("-only_proper_pairs",only_proper_pairs,arguments); minMapQ = angsd::getArg("-minMapQ",minMapQ,arguments); adjustMapQ = angsd::getArg("-C",adjustMapQ,arguments); baq = angsd::getArg("-baq",baq,arguments); ret->region =angsd::getArg("-r",ret->region,arguments); ret->regionfile = angsd::getArg("-rf",ret->regionfile,arguments); ret->nInd = angsd::getArg("-nInd",ret->nInd,arguments); ret->nLines = angsd::getArg("-nLines",ret->nLines,arguments); ret->type = angsd::getArg("-type",ret->type,arguments); ret->show = angsd::getArg("-show",ret->show,arguments); // minQ = angsd::getArg("-minQ",minQ,arguments); if(ret->inputfile && ret->inputfile[0]=='-'){ fprintf(stderr,"[Error] Problem understanding inputfilename: %s\n",ret->inputfile); return NULL; } char *tmp = ""; tmp = angsd::getArg("-ref",tmp,arguments); if(strcmp(tmp,"")==0&&adjustMapQ!=0){ fprintf(stderr,"Must also supply -ref for adjusting the mapping quality\n"); exit(0); } if(strcmp(tmp,"")==0&&baq!=0){ fprintf(stderr,"Must also supply -ref for adjusting base qualities (baq)\n"); exit(0); } printArg(arguments->argumentFile,ret); return ret; }
void bamInfo(FILE *fp){ args *ret = allocArgs(); printArg(fp,ret); }