pub unsafe fn gen_new(
        &mut self,
        builder: LLVMBuilderRef,
        intrinsics: &mut Intrinsics,
        capacity: LLVMValueRef,
        run: LLVMValueRef,
    ) -> WeldResult<LLVMValueRef> {
        if self.new.is_none() {
            let mut arg_tys = [self.i64_type(), self.run_handle_type()];
            let ret_ty = self.dict_ty;
            let name = format!("{}.new", self.name);

            let (function, builder, _) = self.define_function(ret_ty, &mut arg_tys, name);

            LLVMExtAddAttrsOnReturn(self.context, function, &[NoAlias]);
            LLVMExtAddAttrsOnParameter(self.context, function, &[NoAlias, NoCapture, NonNull], 1);

            let capacity = LLVMGetParam(function, 0);
            let run = LLVMGetParam(function, 1);

            // Use a minimum initial capacity.
            let capacity_too_small = LLVMBuildICmp(
                builder,
                LLVMIntSGT,
                self.i64(INITIAL_CAPACITY),
                capacity,
                c_str!(""),
            );
            let capacity = LLVMBuildSelect(
                builder,
                capacity_too_small,
                self.i64(INITIAL_CAPACITY),
                capacity,
                c_str!(""),
            );
            let dict_inner = self.gen_new_dict_with_capacity(builder, intrinsics, capacity, run);

            // Wrap the dictionary in a pointer - the external view of a dictionary is always a
            // pointer so its easier to change the internal layout.
            let alloc_size = self.size_of(self.dict_inner_ty);
            let bytes = intrinsics.call_weld_run_malloc(builder, run, alloc_size, None);
            let dict_pointer = LLVMBuildBitCast(builder, bytes, self.dict_ty, c_str!(""));
            LLVMBuildStore(builder, dict_inner, dict_pointer);
            LLVMBuildRet(builder, dict_pointer);

            LLVMDisposeBuilder(builder);
            self.new = Some(function);
        }

        let mut args = [capacity, run];
        Ok(LLVMBuildCall(
            builder,
            self.new.unwrap(),
            args.as_mut_ptr(),
            args.len() as u32,
            c_str!(""),
        ))
    }
Create a new dictionary.

Dictionaries are hidden behind pointers so their ABI type is always a `void*`.
weld/src/codegen/llvm2/dict.rs