ejsval IRBuilder_createStore(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, val); REQ_LLVM_VAL_ARG(1, ptr); return Value_new (_llvm_builder.CreateStore(val, ptr)); }
ejsval IRBuilder_createOr(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, lhs); REQ_LLVM_VAL_ARG(1, rhs); FALLBACK_EMPTY_UTF8_ARG(2, name); return Value_new (_llvm_builder.CreateOr(lhs, rhs, name)); }
ejsval IRBuilder_createExtractElement(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, val); REQ_LLVM_VAL_ARG(1, idx); FALLBACK_EMPTY_UTF8_ARG(2, name); return Value_new (_llvm_builder.CreateExtractElement(val, idx, name)); }
ejsval IRBuilder_createICmpULt(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, left); REQ_LLVM_VAL_ARG(1, right); FALLBACK_EMPTY_UTF8_ARG(2, name); return Value_new (_llvm_builder.CreateICmpULT(left, right, name)); }
v8::Handle<v8::Value> IRBuilder::CreateStore(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, val); REQ_LLVM_VAL_ARG(1, ptr); Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(IRBuilder::builder.CreateStore(val,ptr))); return scope.Close(result); }
ejsval IRBuilder_createSelect(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, C); REQ_LLVM_VAL_ARG(1, True); REQ_LLVM_VAL_ARG(2, False); FALLBACK_EMPTY_UTF8_ARG(3, name); return Value_new(_llvm_builder.CreateSelect(C, True, False, name)); }
v8::Handle<v8::Value> IRBuilder::CreateNswSub(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, lhs); REQ_LLVM_VAL_ARG(1, rhs); FALLBACK_EMPTY_UTF8_ARG(2, name); Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(IRBuilder::builder.CreateNSWSub(lhs, rhs, *name))); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateExtractElement(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, val); REQ_LLVM_VAL_ARG(1, idx); FALLBACK_EMPTY_UTF8_ARG(2, name); Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(IRBuilder::builder.CreateExtractElement(val,idx, *name))); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateSelect(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, C); REQ_LLVM_VAL_ARG(1, True); REQ_LLVM_VAL_ARG(2, False); FALLBACK_EMPTY_UTF8_ARG(3, name); Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(IRBuilder::builder.CreateSelect(C, True, False, *name))); return scope.Close(result); }
ejsval IRBuilder_createBitCast(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, V); REQ_LLVM_TYPE_ARG(1, dest_ty); FALLBACK_EMPTY_UTF8_ARG(2, name); return Value_new (_llvm_builder.CreateBitCast(V, dest_ty, name)); }
ejsval IRBuilder_createLoad(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, val); FALLBACK_EMPTY_UTF8_ARG(1, name); return LoadInst_new (_llvm_builder.CreateLoad(val, name)); }
ejsval LandingPad_prototype_addClause(ejsval env, ejsval _this, int argc, ejsval *args) { LandingPad *landing_pad = ((LandingPad*)EJSVAL_TO_OBJECT(_this)); REQ_LLVM_VAL_ARG(0, clause_val); landing_pad->llvm_landing_pad->addClause(clause_val); return _ejs_undefined; }
Handle<v8::Value> PHINode::AddIncoming (const Arguments& args) { HandleScope scope; PHINode* phi = ObjectWrap::Unwrap<PHINode>(args.This()); REQ_LLVM_VAL_ARG(0, incoming_val); REQ_LLVM_BB_ARG(1, incoming_bb); phi->llvm_phi->addIncoming(incoming_val, incoming_bb); return scope.Close(Undefined()); }
ejsval IRBuilder_createSwitch(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, V); REQ_LLVM_BB_ARG(1, Dest); REQ_INT_ARG(2, num_cases); return Switch_new (_llvm_builder.CreateSwitch(V, Dest, num_cases)); }
ejsval IRBuilder_createCondBr(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, cond); REQ_LLVM_BB_ARG(1, thenPart); REQ_LLVM_BB_ARG(2, elsePart); return Value_new (_llvm_builder.CreateCondBr(cond, thenPart, elsePart)); }
ejsval IRBuilder_createLandingPad(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_TYPE_ARG(0, ty); REQ_LLVM_VAL_ARG(1, persFn); REQ_INT_ARG(2, num_clauses); FALLBACK_EMPTY_UTF8_ARG(3, name); return LandingPad_new (_llvm_builder.CreateLandingPad(ty, persFn, num_clauses, name)); }
v8::Handle<v8::Value> IRBuilder::CreateLoad(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, val); FALLBACK_EMPTY_UTF8_ARG(1, name); Handle<v8::Value> result = LoadInst::New(IRBuilder::builder.CreateLoad(val, *name)); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateLifetimeEnd(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, val); REQ_LLVM_CONST_INT_ARG(1, size); Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(IRBuilder::builder.CreateLifetimeEnd(val, size))); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateCondBr(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, cond); REQ_LLVM_BB_ARG(1, thenPart); REQ_LLVM_BB_ARG(2, elsePart); Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(IRBuilder::builder.CreateCondBr(cond, thenPart, elsePart))); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateSwitch(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, V); REQ_LLVM_BB_ARG(1, Dest); REQ_INT_ARG(2, num_cases); Handle<v8::Value> result = Switch::New(IRBuilder::builder.CreateSwitch(V, Dest, num_cases)); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateBitCast(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, V); REQ_LLVM_TYPE_ARG(1, dest_ty); FALLBACK_EMPTY_UTF8_ARG(2, name); Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(builder.CreateBitCast(V, dest_ty, *name))); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateLandingPad(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_TYPE_ARG(0, ty); REQ_LLVM_VAL_ARG(1, persFn); REQ_INT_ARG(2, num_clauses); FALLBACK_EMPTY_UTF8_ARG(3, name); Handle<v8::Value> result = LandingPad::New(IRBuilder::builder.CreateLandingPad(ty, persFn, num_clauses, *name)); return scope.Close(result); }
ejsval IRBuilder_createCall(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, callee); REQ_ARRAY_ARG(1, argv); FALLBACK_EMPTY_UTF8_ARG(2, name); std::vector<llvm::Value*> ArgsV; for (unsigned i = 0, e = EJSARRAY_LEN(argv); i != e; ++i) { ArgsV.push_back (Value_GetLLVMObj(EJSDENSEARRAY_ELEMENTS(argv)[i])); if (ArgsV.back() == 0) abort(); // XXX throw an exception here } return Call_new (_llvm_builder.CreateCall(callee, ArgsV, name)); }
ejsval IRBuilder_createInBoundsGetElementPointer(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0, val); REQ_ARRAY_ARG(1, idxv); FALLBACK_EMPTY_UTF8_ARG(2, name); std::vector<llvm::Value*> IdxV; for (unsigned i = 0, e = EJSARRAY_LEN(idxv); i != e; ++i) { IdxV.push_back (Value_GetLLVMObj(EJSDENSEARRAY_ELEMENTS(idxv)[i])); if (IdxV.back() == 0) abort(); // XXX throw an exception here } return Value_new (_llvm_builder.CreateInBoundsGEP(val, IdxV, name)); }
v8::Handle<v8::Value> IRBuilder::CreateCall(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, callee); REQ_ARRAY_ARG(1, argv); FALLBACK_EMPTY_UTF8_ARG(2, name); std::vector<llvm::Value*> ArgsV; for (unsigned i = 0, e = argv->Length(); i != e; ++i) { llvm::Value* arg = Value::GetLLVMObj(argv->Get(i)); ArgsV.push_back(arg); if (ArgsV.back() == 0) abort(); // XXX throw an exception here } Handle<v8::Value> result = Call::New(IRBuilder::builder.CreateCall(callee, ArgsV, *name)); return scope.Close(result); }
v8::Handle<v8::Value> IRBuilder::CreateInBoundsGetElementPointer(const v8::Arguments& args) { HandleScope scope; REQ_LLVM_VAL_ARG(0, val); REQ_ARRAY_ARG(1, idxv); FALLBACK_EMPTY_UTF8_ARG(2, name); std::vector<llvm::Value*> IdxV; for (unsigned i = 0, e = idxv->Length(); i != e; ++i) { llvm::Value* idx = Value::GetLLVMObj(idxv->Get(i)); IdxV.push_back(idx); if (IdxV.back() == 0) abort(); // XXX throw an exception here } Handle<v8::Value> result = Instruction::New(static_cast<llvm::Instruction*>(IRBuilder::builder.CreateInBoundsGEP(val, IdxV, *name))); return scope.Close(result); }
ejsval IRBuilder_createRet(ejsval env, ejsval _this, int argc, ejsval *args) { REQ_LLVM_VAL_ARG(0,val); return Value_new(_llvm_builder.CreateRet(val)); }