本文整理汇总了C++中IRBuilder::CreateSub方法的典型用法代码示例。如果您正苦于以下问题:C++ IRBuilder::CreateSub方法的具体用法?C++ IRBuilder::CreateSub怎么用?C++ IRBuilder::CreateSub使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRBuilder
的用法示例。
在下文中一共展示了IRBuilder::CreateSub方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getValue
Value* SubtractionExpression::getValue() {
assert(leftExpression != NULL);
assert(rightExpression != NULL);
IRBuilder<>* builder = codegen::getBuilder();
return builder->CreateSub(leftExpression->getValue(), rightExpression->getValue());
}
示例2: codeGen
Value* Op::codeGen(CodeGenContext &context) {
cout << "Creating Op " << op <<endl;
IRBuilder<> *builder = context.currentBuilder();
Value *tape_1;
Value *lshValue = lhs.codeGen(context);
Value *rshValue = rhs.codeGen(context);
switch(op) {
case T_PLUS:
tape_1 = builder->CreateAdd(lshValue,
rshValue, "addtmp");
break;
case T_MINUS:
tape_1 = builder->CreateSub(lshValue,
rshValue, "subtmp");
break;
case T_DIV:
tape_1 = builder->CreateUDiv(lshValue,
rshValue, "divtmp");
break;
case T_MUL:
tape_1 = builder->CreateMul(lshValue,
rshValue, "multmp");
break;
case T_LT:
tape_1 = builder->CreateICmpSLT(lshValue,
rshValue, "lttmp");
break;
case T_GT:
tape_1 = builder->CreateICmpSGT(lshValue,
rshValue, "gttmp");
break;
}
return tape_1;
}
示例3: compile_minus
/// compile_minus - Emit code for '-'
void BrainFTraceRecorder::compile_minus(BrainFTraceNode *node,
IRBuilder<>& builder) {
Value *CellValue = builder.CreateLoad(DataPtr);
Constant *One =
ConstantInt::get(IntegerType::getInt8Ty(Header->getContext()), 1);
Value *UpdatedValue = builder.CreateSub(CellValue, One);
builder.CreateStore(UpdatedValue, DataPtr);
if (node->left != (BrainFTraceNode*)~0ULL)
compile_opcode(node->left, builder);
else {
HeaderPHI->addIncoming(DataPtr, builder.GetInsertBlock());
builder.CreateBr(Header);
}
}