当前位置: 首页>>代码示例>>C++>>正文


C++ StoreInst::setAtomic方法代码示例

本文整理汇总了C++中StoreInst::setAtomic方法的典型用法代码示例。如果您正苦于以下问题:C++ StoreInst::setAtomic方法的具体用法?C++ StoreInst::setAtomic怎么用?C++ StoreInst::setAtomic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StoreInst的用法示例。


在下文中一共展示了StoreInst::setAtomic方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wrap

extern "C" LLVMValueRef LLVMBuildAtomicStore(LLVMBuilderRef B,
                                             LLVMValueRef val,
                                             LLVMValueRef target,
                                             AtomicOrdering order,
                                             unsigned alignment) {
    StoreInst* si = new StoreInst(unwrap(val),unwrap(target));
    si->setAtomic(order);
    si->setAlignment(alignment);
    return wrap(unwrap(B)->Insert(si));
}
开发者ID:Arubaruba,项目名称:rust,代码行数:10,代码来源:RustWrapper.cpp

示例2: wrap

extern "C" LLVMValueRef LLVMRustBuildAtomicStore(LLVMBuilderRef B,
                                                 LLVMValueRef V,
                                                 LLVMValueRef Target,
                                                 LLVMAtomicOrdering Order,
                                                 unsigned Alignment) {
  StoreInst *SI = new StoreInst(unwrap(V), unwrap(Target));
  SI->setAtomic(fromRust(Order));
  SI->setAlignment(Alignment);
  return wrap(unwrap(B)->Insert(SI));
}
开发者ID:Boreeas,项目名称:rust,代码行数:10,代码来源:RustWrapper.cpp

示例3: wrap

extern "C" LLVMValueRef LLVMBuildAtomicStore(LLVMBuilderRef B,
                                            LLVMValueRef val,
                                            LLVMValueRef target,
                                            AtomicOrdering order) {
    StoreInst* si = new StoreInst(unwrap(val),unwrap(target));
    si->setVolatile(true);
    si->setAtomic(order);
    si->setAlignment(sizeof(intptr_t));
    return wrap(unwrap(B)->Insert(si));
}
开发者ID:1100110,项目名称:rust,代码行数:10,代码来源:RustWrapper.cpp

示例4: Builder

/// Convert an atomic store of a non-integral type to an integer store of the
/// equivelent bitwidth.  We used to not support floating point or vector
/// atomics in the IR at all.  The backends learned to deal with the bitcast
/// idiom because that was the only way of expressing the notion of a atomic
/// float or vector store.  The long term plan is to teach each backend to
/// instruction select from the original atomic store, but as a migration
/// mechanism, we convert back to the old format which the backends understand.
/// Each backend will need individual work to recognize the new format.
StoreInst *AtomicExpand::convertAtomicStoreToIntegerType(StoreInst *SI) {
  IRBuilder<> Builder(SI);
  auto *M = SI->getModule();
  Type *NewTy = getCorrespondingIntegerType(SI->getValueOperand()->getType(),
                                            M->getDataLayout());
  Value *NewVal = Builder.CreateBitCast(SI->getValueOperand(), NewTy);

  Value *Addr = SI->getPointerOperand();
  Type *PT = PointerType::get(NewTy,
                              Addr->getType()->getPointerAddressSpace());
  Value *NewAddr = Builder.CreateBitCast(Addr, PT);

  StoreInst *NewSI = Builder.CreateStore(NewVal, NewAddr);
  NewSI->setAlignment(SI->getAlignment());
  NewSI->setVolatile(SI->isVolatile());
  NewSI->setAtomic(SI->getOrdering(), SI->getSynchScope());
  DEBUG(dbgs() << "Replaced " << *SI << " with " << *NewSI << "\n");
  SI->eraseFromParent();
  return NewSI;
}
开发者ID:mirams,项目名称:opencor,代码行数:28,代码来源:AtomicExpandPass.cpp


注:本文中的StoreInst::setAtomic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。