Hi Chris, > Duncan, this patch gets llvm-gcc to build, but it still doesn't > answer the big question: why does TargetData contain information > about the host?
well, it needed to go somewhere. Any suggestions for a better place? Another possibility is to have a function isWrongEndian in target data, which tells you if the target has opposite endianness to the host. > I don't think this is the right approach. Also, you > can get the host endianness without autoconf by using something > simple like: > > bool islittleendian() { > union { > int i; > char c; > }; > > i = 1; > return c; > } I have no particular opinion on this (except that it's amazing to me that there's no standard way to query the compiler for this in C++ :) ). Presumably the compiler will reduce this function to: return true; (or false) at compile time, so there's no cost to your approach. I suppose that plenty of things that autoconf does could also be done in a special function like this, yet they are left to autoconf - I have no idea what the criteria are for doing something via autoconf or via a runtime test. Having the function inline in a header would have the advantage that the compiler would eliminate a bunch of code in ExecutionEngine at runtime. Since it seems that the autoconf solution is not compatible with being exposed in a header, that suggests your solution is the way to go. Ciao, Duncan. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits