pub unsafe fn gen_size(
        &mut self,
        builder: LLVMBuilderRef,
        vector: LLVMValueRef,
    ) -> WeldResult<LLVMValueRef> {
        if self.size.is_none() {
            let mut arg_tys = [self.vector_ty];
            let ret_ty = self.i64_type();

            let name = format!("{}.size", self.name);
            let (function, builder, _) = self.define_function(ret_ty, &mut arg_tys, name);

            LLVMExtAddAttrsOnFunction(self.context, function, &[AlwaysInline]);

            let vector = LLVMGetParam(function, 0);
            let size = LLVMBuildExtractValue(builder, vector, SIZE_INDEX, c_str!(""));
            LLVMBuildRet(builder, size);

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

        let mut args = [vector];
        Ok(LLVMBuildCall(
            builder,
            self.size.unwrap(),
            args.as_mut_ptr(),
            args.len() as u32,
            c_str!(""),
        ))
    }
Generates the `size` method on vectors and calls it.

This returns the size (equivalently, the capacity) of the vector.
weld/src/codegen/llvm2/vector.rs