Previously, the transitory state only needed and valid during
generation of the LLVM IR for the function body was conflated
with the general codegen metadata for the function declaration
in IrFunction.
There is further potential for cleanup regarding the use of
gIR->func() and so on all over the code base, but this is out
of scope of this commit, which is only concerned with those
IrFunction members moved to FuncGenState.
GitHub: Fixes#1661.
That's apparently what DMD does and what currently happens for all
non-MSVC targets anyway.
For MSVC, we need this to enforce the `any` selection instead of
`no duplicates`, otherwise the linker complains about multiply defined
symbols and refuses to link without an extra command line option
(which in turn outputs a non-suppressable warning).
Add LLVM zeroext attribute to char and wchar types so they are
compatible with similar sized C ABI unsigned int types.
In particular, this is needed for ARM (fixes runnable/cppa.d at -O3)
and seems like proper behavior for all supported ABIs even though the
x86 ABIs get by without this.
Note that we don't set t->ctype (we'd need a new IrTypeEnum or something
along the lines). This is okay because we don't do so for enums in either
case, even in the normal code paths. Enums are regarded as being
"transparent" in that sense. We might want to rethink this in the future,
though.
Fixes DMD test case 'ice13792'.
Also adds the CMake infrastructure to compile and link the D source files.
The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
LP64 defines a C environment with 64bit pointers and char/short/int/long
are 8/16/32/64bit. char/short/int/long have defined sizes in D. We need
to look only at the pointer size.
There are now 64bit environments with 32bit pointers. Examples are
x32 in Intel and N32 on MIPS64. For these environments D_LP64 should
not defined but the global.param.is64bit is still true. The definition
of size_t is also affected. If only 32bit are addressable then size_t
should also be a 32bit type. (This is not required by C standard but
common practize.)
The net result is that not only the definition of D_LP64 must be changed
but also DtoSize_t().