[llvm-dev] Cast between struct (original) (raw)
Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Wed May 6 18:53:49 PDT 2020
- Previous message: [llvm-dev] Cast between struct
- Next message: [llvm-dev] Cast between struct
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You can
- extract individual elements of {i8*, i64},
- bitcast the first to some_struct*,
- insert them into a new struct of type {some_struct*, i64}.
-- Krzysztof Parzyszek kparzysz at quicinc.com AI tools development
-----Original Message----- From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Jie Zhou via llvm-dev Sent: Wednesday, May 6, 2020 7:17 PM To: Joerg Sonnenberger via llvm-dev <llvm-dev at lists.llvm.org> Subject: [EXT] [llvm-dev] Cast between struct
Dear All, In my development, a function returns a struct {i8*, i64}, and on the call site I need to assign the return value to a struct of type {somestruct*, i64}. One way to do it is to call the mutateType() method of llvm::Value on the return value of the function call; however, I’m concerned that this mutateType() method might be too disruptive (it’s discouraged to use it by the documentation). Since LLVM does not support cast between structs. Is there any way I can safely “cast” a value of one struct type to another? Thanks, - Jie
LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
- Previous message: [llvm-dev] Cast between struct
- Next message: [llvm-dev] Cast between struct
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]