(original) (raw)
Fundamentally, llvm is not designed to preserve details about front end language features.
On Thu, 7 Feb 2019 at 00:09, Peng Yu via llvm-dev <llvm-dev@lists.llvm.org> wrote:
Hi,
I have the following C code.
#define PTR\_T char \*
typedef struct objcache {
PTR\_T data;
int cs; /\* cache size, number of objects \*/
int nc; /\* number of cache entries \*/
} sh\_obj\_cache\_t;
struct dstack {
char \*delimiters;
int delimiter\_depth;
int delimiter\_space;
};
When it is configured/made to generate IR with the following
environment variables,
CC=clang CXX=clang++ RANLIB=llvm-ranlib CFLAGS=-flto LDFLAGS=-flto\\
\-fuse-ld=gold\\ -Wl\\,-plugin-opt=save-temps
I see all the variables declared as sh\_obj\_cache\_t in the source code
becomes of type %struct.dstack instead of %struct.objcache.
sh\_obj\_cache\_t wdcache = {0, 0, 0};
@wdcache = dso\_local global %struct.dstack zeroinitializer, align 8, !dbg !1189
If I directly compile the .c file to .ll, I will not see this problem.
Is there a way to still use the configure/make toolchain, yet still
maintain the original type information instead of consolidating types
of the same data? Thanks.
\--
Regards,
Peng
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
LLVM Developers mailing list
llvm-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev