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

Method switch

crates/rustc_codegen_nvvm/src/builder.rs:245–258  ·  view source on GitHub ↗
(
        &mut self,
        v: &'ll Value,
        else_llbb: &'ll BasicBlock,
        cases: impl ExactSizeIterator<Item = (u128, &'ll BasicBlock)>,
    )

Source from the content-addressed store, hash-verified

243 }
244
245 fn switch(
246 &mut self,
247 v: &'ll Value,
248 else_llbb: &'ll BasicBlock,
249 cases: impl ExactSizeIterator<Item = (u128, &'ll BasicBlock)>,
250 ) {
251 trace!("Switch `{:?}`", v);
252 let switch =
253 unsafe { llvm::LLVMBuildSwitch(self.llbuilder, v, else_llbb, cases.len() as c_uint) };
254 for (on_val, dest) in cases {
255 let on_val = self.const_uint_big(self.val_ty(v), on_val);
256 unsafe { llvm::LLVMAddCase(switch, on_val, dest) }
257 }
258 }
259
260 fn invoke(
261 &mut self,

Callers

nothing calls this directly

Calls 3

const_uint_bigMethod · 0.80
val_tyMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected