示例#1
0
    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));
    }
示例#2
0
 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));
 }
示例#3
0
    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));
    }
示例#4
0
    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));
    }
示例#5
0
  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);
  }
示例#6
0
    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));
    }
示例#7
0
  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);
  }
示例#8
0
  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);
  }
示例#9
0
  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);
  }
示例#10
0
 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));
 }
示例#11
0
    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));
    }
示例#12
0
 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;
 }
示例#13
0
 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());
 }
示例#14
0
    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));
    }
示例#15
0
    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));
    }
示例#16
0
    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));
    }
示例#17
0
  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);
  }
示例#18
0
  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);
  }
示例#19
0
  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);
  }
示例#20
0
  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);
  }
示例#21
0
  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);
  }
示例#22
0
  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);
  }
示例#23
0
    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));
    }
示例#24
0
    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));
    }
示例#25
0
  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);
  }
示例#26
0
  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);
  }
示例#27
0
 ejsval
 IRBuilder_createRet(ejsval env, ejsval _this, int argc, ejsval *args)
 {
     REQ_LLVM_VAL_ARG(0,val);
     return Value_new(_llvm_builder.CreateRet(val));
 }