本文整理汇总了C++中IRBuilder::CreateSExt方法的典型用法代码示例。如果您正苦于以下问题:C++ IRBuilder::CreateSExt方法的具体用法?C++ IRBuilder::CreateSExt怎么用?C++ IRBuilder::CreateSExt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRBuilder
的用法示例。
在下文中一共展示了IRBuilder::CreateSExt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equalizeTypes
void equalizeTypes(Value* &Op1, Value* &Op2, bool isSigned, IRBuilder<> Builder){
if (Op1->getType() != Op2->getType()) {
if (Op1->getType()->getIntegerBitWidth() > Op2->getType()->getIntegerBitWidth() ) {
//expand op2
if (isSigned) Op2 = Builder.CreateSExt(Op2, Op1->getType(), "");
else Op2 = Builder.CreateZExt(Op2, Op1->getType(), "");
} else {
//expand op1
if (isSigned) Op1 = Builder.CreateSExt(Op1, Op2->getType(), "");
else Op1 = Builder.CreateZExt(Op1, Op2->getType(), "");
}
}
}
示例2: compile_put
/// compile_put - Emit code for '.'
void BrainFTraceRecorder::compile_put(BrainFTraceNode *node,
IRBuilder<>& builder) {
Value *Loaded = builder.CreateLoad(DataPtr);
Value *Print =
builder.CreateSExt(Loaded, IntegerType::get(Loaded->getContext(), 32));
builder.CreateCall(putchar_func, Print);
if (node->left != (BrainFTraceNode*)~0ULL)
compile_opcode(node->left, builder);
else {
HeaderPHI->addIncoming(DataPtr, builder.GetInsertBlock());
builder.CreateBr(Header);
}
}