How to get the memory space type of llvm dialect operation's operand or parameter and pass it to llvm IR?

Here is the llvm dialect code:

module {
       llvm.func @mat_test(%arg0i:i32)
       {
           ......
           llvm.return
       }
   }

I want to get the memory space type of %arg0, and save it as a metadata info. It seems that the ‘mlir-translate’ tool can not do this.
The questions are:

  1. how to get the memory space type of an argument?
  2. how to pass the memory space type metadata to llvm IR?