MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / store_with_flags

Method store_with_flags

crates/rustc_codegen_nvvm/src/builder.rs:673–704  ·  view source on GitHub ↗
(
        &mut self,
        val: &'ll Value,
        ptr: &'ll Value,
        align: Align,
        flags: MemFlags,
    )

Source from the content-addressed store, hash-verified

671 }
672
673 fn store_with_flags(
674 &mut self,
675 val: &'ll Value,
676 ptr: &'ll Value,
677 align: Align,
678 flags: MemFlags,
679 ) -> &'ll Value {
680 let ptr = self.check_store(val, ptr);
681 unsafe {
682 let store = llvm::LLVMBuildStore(self.llbuilder, val, ptr);
683 let align = if flags.contains(MemFlags::UNALIGNED) {
684 1
685 } else {
686 align.bytes() as c_uint
687 };
688 llvm::LLVMSetAlignment(store, align);
689 if flags.contains(MemFlags::VOLATILE) {
690 llvm::LLVMSetVolatile(store, llvm::True);
691 }
692 if flags.contains(MemFlags::NONTEMPORAL) {
693 // According to LLVM [1] building a nontemporal store must
694 // *always* point to a metadata value of the integer 1.
695 //
696 // [1]: http://llvm.org/docs/LangRef.html#store-instruction
697 let one = self.cx.const_i32(1);
698 let node = llvm::LLVMMDNodeInContext(self.cx.llcx, &one, 1);
699 llvm::LLVMSetMetadata(store, llvm::MetadataType::MD_nontemporal as c_uint, node);
700 }
701
702 store
703 }
704 }
705
706 fn atomic_store(
707 &mut self,

Callers 1

storeMethod · 0.80

Calls 3

check_storeMethod · 0.80
const_i32Method · 0.80
containsMethod · 0.45

Tested by

no test coverage detected