Removed TypeOpaque from DMD.

Changed runtime functions taking opaque[] to void[].
Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[].
Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86.
Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing.
Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way...
Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8.
Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
This commit is contained in:
Tomas Lindquist Olsen
2008-10-22 14:55:33 +02:00
parent 50484db204
commit f7ea1da010
25 changed files with 506 additions and 624 deletions

View File

@@ -2,181 +2,177 @@
#include "mtype.h"
unsigned char Type::impcnvResult[TMAX][TMAX] =
{
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,22,23,24,28,29,30,19,19,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,22,23,24,28,29,30,20,20,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,22,23,24,28,29,30,21,21,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,22,23,24,28,29,30,22,22,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,23,23,24,29,29,30,23,23,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,24,24,24,30,30,30,24,24,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,28,28,28,28,28,28,28,28,28,29,30,28,29,30,28,29,30,28,28,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,29,29,29,29,29,29,29,29,29,29,30,29,29,30,29,29,30,29,29,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,32,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,22,23,24,28,29,30,19,19,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,22,23,24,28,29,30,20,20,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,22,23,24,28,29,30,21,21,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,22,23,24,28,29,30,22,22,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,23,23,24,29,29,30,23,23,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,24,24,24,30,30,30,24,24,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,28,28,28,28,28,28,28,28,28,29,30,28,29,30,28,29,30,28,28,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,29,29,29,29,29,29,29,29,29,29,30,29,29,30,29,29,30,29,29,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,32,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
};
unsigned char Type::impcnvType1[TMAX][TMAX] =
{
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,22,23,24,22,23,24,19,19,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,22,23,24,22,23,24,20,20,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,22,23,24,22,23,24,21,21,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,22,23,24,22,23,24,22,22,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,23,23,24,23,23,24,23,23,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,25,25,25,25,25,25,25,25,25,26,27,25,26,27,25,26,27,25,25,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,26,26,26,26,26,26,26,26,26,26,27,26,26,27,26,26,27,26,26,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,28,28,28,28,28,28,28,28,28,29,30,28,29,30,28,29,30,28,28,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,29,29,29,29,29,29,29,29,29,29,30,29,29,30,29,29,30,29,29,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,32,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,22,23,24,22,23,24,19,19,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,22,23,24,22,23,24,20,20,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,22,23,24,22,23,24,21,21,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,22,23,24,22,23,24,22,22,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,23,23,24,23,23,24,23,23,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,25,25,25,25,25,25,25,25,25,26,27,25,26,27,25,26,27,25,25,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,26,26,26,26,26,26,26,26,26,26,27,26,26,27,26,26,27,26,26,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,28,28,28,28,28,28,28,28,28,29,30,28,29,30,28,29,30,28,28,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,29,29,29,29,29,29,29,29,29,29,30,29,29,30,29,29,30,29,29,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,32,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
};
unsigned char Type::impcnvType2[TMAX][TMAX] =
{
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,19,19,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,25,26,27,28,29,30,20,20,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,25,26,27,28,29,30,21,21,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,32,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,18,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,19,19,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,25,26,27,28,29,30,20,20,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,25,26,27,28,29,30,21,21,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,22,22,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,23,23,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,24,24,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,18,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,32,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
};
unsigned char Type::impcnvWarn[TMAX][TMAX] =
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};

View File

@@ -103,9 +103,6 @@ ClassDeclaration *Type::typeinfofunction;
ClassDeclaration *Type::typeinfodelegate;
ClassDeclaration *Type::typeinfotypelist;
// LDC
Type* Type::topaque;
Type *Type::tvoidptr;
Type *Type::basic[TMAX];
unsigned char Type::mangleChar[TMAX];
@@ -210,9 +207,6 @@ void Type::init()
mangleChar[Ttuple] = 'B';
mangleChar[Tslice] = '@';
// LDC
mangleChar[Topaque] = 'O';
for (i = 0; i < TMAX; i++)
{ if (!mangleChar[i])
fprintf(stdmsg, "ty = %d\n", i);
@@ -234,9 +228,6 @@ void Type::init()
tvoidptr = tvoid->pointerTo();
// LDC
topaque = new TypeOpaque();
// set size_t / ptrdiff_t types and pointer size
if (global.params.is64bit)
{
@@ -1625,15 +1616,15 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
if(!adDup_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL));
args->push(new Argument(STCin, Type::topaque->arrayOf(), NULL, NULL));
adDup_fd = FuncDeclaration::genCfunc(args, Type::topaque->arrayOf(), Id::adDup);
args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL));
adDup_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adDup);
}
static FuncDeclaration *adReverse_fd = NULL;
if(!adReverse_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->arrayOf(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
adReverse_fd = FuncDeclaration::genCfunc(args, Type::topaque->arrayOf(), Id::adReverse);
adReverse_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::adReverse);
}
if(dup)
@@ -1644,7 +1635,14 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
arguments = new Expressions();
if (dup)
arguments->push(getTypeInfo(sc));
arguments->push(e);
// LDC repaint array type to void[]
if (n->ty != Tvoid) {
e = new CastExp(e->loc, e, e->type);
e->type = Type::tvoid->arrayOf();
}
arguments->push(e);
if (!dup)
arguments->push(new IntegerExp(0, size, Type::tint32));
e = new CallExp(e->loc, ec, arguments);
@@ -1660,16 +1658,16 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *adSort_fd = NULL;
if(!adSort_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->arrayOf(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL));
adSort_fd = FuncDeclaration::genCfunc(args, Type::topaque->arrayOf(), "_adSort");
adSort_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSort");
}
static FuncDeclaration *adSortBit_fd = NULL;
if(!adSortBit_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->arrayOf(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->arrayOf(), NULL, NULL));
args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL));
adSortBit_fd = FuncDeclaration::genCfunc(args, Type::topaque->arrayOf(), "_adSortBit");
adSortBit_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), "_adSortBit");
}
if(isBit)
@@ -1678,7 +1676,14 @@ Expression *TypeArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
ec = new VarExp(0, adSort_fd);
e = e->castTo(sc, n->arrayOf()); // convert to dynamic array
arguments = new Expressions();
arguments->push(e);
// LDC repaint array type to void[]
if (n->ty != Tvoid) {
e = new CastExp(e->loc, e, e->type);
e->type = Type::tvoid->arrayOf();
}
arguments->push(e);
if (next->ty != Tbit)
arguments->push(n->getTypeInfo(sc)); // LDC, we don't support the getInternalTypeInfo
// optimization arbitrarily, not yet at least...
@@ -2350,7 +2355,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaLen_fd = NULL;
if(!aaLen_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
aaLen_fd = FuncDeclaration::genCfunc(args, Type::tsize_t, Id::aaLen);
}
@@ -2371,9 +2376,9 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaKeys_fd = NULL;
if(!aaKeys_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
aaKeys_fd = FuncDeclaration::genCfunc(args, Type::topaque->arrayOf(), Id::aaKeys);
aaKeys_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaKeys);
}
ec = new VarExp(0, aaKeys_fd);
@@ -2392,10 +2397,10 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaValues_fd = NULL;
if(!aaValues_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
aaValues_fd = FuncDeclaration::genCfunc(args, Type::topaque->arrayOf(), Id::aaValues);
aaValues_fd = FuncDeclaration::genCfunc(args, Type::tvoid->arrayOf(), Id::aaValues);
}
ec = new VarExp(0, aaValues_fd);
@@ -2417,7 +2422,7 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e, Identifier *ident)
static FuncDeclaration *aaRehash_fd = NULL;
if(!aaRehash_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::typeinfo->type, NULL, NULL));
aaRehash_fd = FuncDeclaration::genCfunc(args, Type::tvoidptr, Id::aaRehash);
}
@@ -5242,16 +5247,6 @@ void TypeSlice::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod)
buf->printf("%s]", upr->toChars());
}
void TypeOpaque::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod)
{
//printf("TypeOpaquePtr::toCBuffer2()");
if (mod != this->mod)
{ toCBuffer3(buf, hgs, mod);
return;
}
buf->writestring("opaque");
}
/***************************** Argument *****************************/
Argument::Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg)

View File

@@ -98,9 +98,6 @@ enum TY
Ttuple,
Tslice,
// LDC
Topaque,
TMAX
};
@@ -177,10 +174,6 @@ struct Type : Object
static ClassDeclaration *typeinfodelegate;
static ClassDeclaration *typeinfotypelist;
// LDC, for runtime function signatures that contain
// AAs or arrays of unknown type
static Type* topaque;
static Type *basic[TMAX];
static unsigned char mangleChar[TMAX];
static StringTable stringtable;
@@ -674,13 +667,6 @@ struct TypeSlice : Type
void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
};
//LDC
struct TypeOpaque : Type
{
TypeOpaque() : Type(Topaque, NULL) {}
void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
};
/**************************************************************/
//enum InOut { None, In, Out, InOut, Lazy };

View File

@@ -1602,7 +1602,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
static FuncDeclaration *aaApply2_fd = NULL;
if(!aaApply2_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
Arguments* dgargs = new Arguments;
dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
@@ -1614,7 +1614,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
static FuncDeclaration *aaApply_fd = NULL;
if(!aaApply_fd) {
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tvoid->pointerTo(), NULL, NULL));
args->push(new Argument(STCin, Type::tsize_t, NULL, NULL));
Arguments* dgargs = new Arguments;
dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
@@ -1669,7 +1669,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
assert(j < sizeof(fdname));
//LDC: Build arguments.
Arguments* args = new Arguments;
args->push(new Argument(STCin, Type::topaque->arrayOf(), NULL, NULL));
args->push(new Argument(STCin, tn->arrayOf(), NULL, NULL));
if (dim == 2) {
Arguments* dgargs = new Arguments;
dgargs->push(new Argument(STCin, Type::tvoidptr, NULL, NULL));
@@ -1689,7 +1689,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
Expressions *exps = new Expressions();
if (tab->ty == Tsarray)
aggr = aggr->castTo(sc, tn->arrayOf());
exps->push(aggr);
exps->push(aggr);
exps->push(flde);
e = new CallExp(loc, ec, exps);
e->type = Type::tindex; // don't run semantic() on e

View File

@@ -55,56 +55,10 @@ void DtoSetArrayToNull(LLValue* v)
Logger::println("DtoSetArrayToNull");
LOG_SCOPE;
LLValue* len = DtoGEPi(v,0,0);
LLValue* zerolen = llvm::ConstantInt::get(len->getType()->getContainedType(0), 0, false);
DtoStore(zerolen, len);
assert(isaPointer(v));
const LLType* t = v->getType()->getContainedType(0);
LLValue* ptr = DtoGEPi(v,0,1);
const LLPointerType* pty = isaPointer(ptr->getType()->getContainedType(0));
LLValue* nullptr = llvm::ConstantPointerNull::get(pty);
DtoStore(nullptr, ptr);
}
//////////////////////////////////////////////////////////////////////////////////////////
void DtoArrayAssign(LLValue* dst, LLValue* src)
{
Logger::println("DtoArrayAssign");
LOG_SCOPE;
assert(gIR);
if (dst->getType() == src->getType())
{
LLValue* ptr = DtoGEPi(src,0,0);
LLValue* val = DtoLoad(ptr);
ptr = DtoGEPi(dst,0,0);
DtoStore(val, ptr);
ptr = DtoGEPi(src,0,1);
val = DtoLoad(ptr);
ptr = DtoGEPi(dst,0,1);
DtoStore(val, ptr);
}
else
{
if (Logger::enabled())
Logger::cout() << "array assignment type dont match: " << *dst->getType() << "\n\n" << *src->getType() << '\n';
const LLArrayType* arrty = isaArray(src->getType()->getContainedType(0));
if (!arrty)
{
std::cout << "invalid: " << *src << '\n';
assert(0);
}
const LLType* dstty = getPtrToType(arrty->getElementType());
LLValue* dstlen = DtoGEPi(dst,0,0);
LLValue* srclen = DtoConstSize_t(arrty->getNumElements());
DtoStore(srclen, dstlen);
LLValue* dstptr = DtoGEPi(dst,0,1);
LLValue* srcptr = DtoBitCast(src, dstty);
DtoStore(srcptr, dstptr);
}
DtoStore(LLConstant::getNullValue(t), v);
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -684,64 +638,24 @@ static LLValue* DtoArrayEqCmp_impl(Loc& loc, const char* func, DValue* l, DValue
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, func);
assert(fn);
LLValue* lmem;
LLValue* rmem;
// find common dynamic array type
Type* commonType = l->getType()->toBasetype()->nextOf()->arrayOf();
// cast static arrays to dynamic ones, this turns them into DSliceValues
Logger::println("casting to dynamic arrays");
Type* l_ty = l->getType()->toBasetype();
Type* r_ty = r->getType()->toBasetype();
assert(l_ty->next == r_ty->next);
if ((l_ty->ty == Tsarray) || (r_ty->ty == Tsarray)) {
Type* a_ty = l_ty->next->arrayOf();
if (l_ty->ty == Tsarray)
l = DtoCastArray(loc, l, a_ty);
if (r_ty->ty == Tsarray)
r = DtoCastArray(loc, r, a_ty);
}
Logger::println("giving storage");
// we need to give slices storage
if (l->isSlice()) {
lmem = DtoAlloca(DtoType(l->getType()), "tmpparam");
DtoSetArray(lmem, DtoArrayLen(l), DtoArrayPtr(l));
}
// also null
else if (l->isNull())
{
lmem = DtoAlloca(DtoType(l->getType()), "tmpparam");
DtoSetArray(lmem, llvm::Constant::getNullValue(DtoSize_t()), llvm::Constant::getNullValue(DtoType(l->getType()->next->pointerTo())));
}
else
lmem = l->getRVal();
// and for the rvalue ...
// we need to give slices storage
if (r->isSlice()) {
rmem = DtoAlloca(DtoType(r->getType()), "tmpparam");
DtoSetArray(rmem, DtoArrayLen(r), DtoArrayPtr(r));
}
// also null
else if (r->isNull())
{
rmem = DtoAlloca(DtoType(r->getType()), "tmpparam");
DtoSetArray(rmem, llvm::Constant::getNullValue(DtoSize_t()), llvm::Constant::getNullValue(DtoType(r->getType()->next->pointerTo())));
}
else
rmem = r->getRVal();
const LLType* pt = fn->getFunctionType()->getParamType(0);
l = DtoCastArray(loc, l, commonType);
r = DtoCastArray(loc, r, commonType);
LLValue* lmem;
LLValue* rmem;
LLSmallVector<LLValue*, 3> args;
if (Logger::enabled())
{
Logger::cout() << "bitcasting to " << *pt << '\n';
Logger::cout() << *lmem << '\n';
Logger::cout() << *rmem << '\n';
}
args.push_back(DtoBitCast(lmem,pt));
args.push_back(DtoBitCast(rmem,pt));
// get values, reinterpret cast to void[]
lmem = DtoAggrPaint(l->getRVal(), DtoArrayType(LLType::Int8Ty));
args.push_back(lmem);
rmem = DtoAggrPaint(r->getRVal(), DtoArrayType(LLType::Int8Ty));
args.push_back(rmem);
// pass array typeinfo ?
if (useti) {
@@ -753,18 +667,11 @@ static LLValue* DtoArrayEqCmp_impl(Loc& loc, const char* func, DValue* l, DValue
if (Logger::enabled())
Logger::cout() << "typeinfo decl: " << *tival << '\n';
pt = fn->getFunctionType()->getParamType(2);
args.push_back(DtoBitCast(tival, pt));
args.push_back(DtoBitCast(tival, fn->getFunctionType()->getParamType(2)));
}
CallOrInvoke* call = gIR->CreateCallOrInvoke(fn, args.begin(), args.end(), "tmp");
// set param attrs
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
call->setAttributes(palist);
return call->get();
}
@@ -917,7 +824,9 @@ LLValue* DtoArrayLen(DValue* v)
return s->len;
else if (v->isNull())
return DtoConstSize_t(0);
return DtoLoad(DtoGEPi(v->getRVal(), 0,0));
else if (v->isLVal())
return DtoLoad(DtoGEPi(v->getLVal(), 0,0), ".len");
return gIR->ir->CreateExtractValue(v->getRVal(), 0, ".len");
}
else if (t->ty == Tsarray) {
assert(!v->isSlice());
@@ -943,7 +852,9 @@ LLValue* DtoArrayPtr(DValue* v)
return s->ptr;
else if (v->isNull())
return getNullPtr(getPtrToType(DtoType(t->next)));
return DtoLoad(DtoGEPi(v->getRVal(), 0,1));
else if (v->isLVal())
return DtoLoad(DtoGEPi(v->getLVal(), 0,1), ".ptr");
return gIR->ir->CreateExtractValue(v->getRVal(), 1, ".ptr");
}
else if (t->ty == Tsarray) {
assert(!v->isSlice());
@@ -1046,7 +957,6 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to)
return new DImValue(to, rval);
}
//////////////////////////////////////////////////////////////////////////////////////////
void DtoArrayBoundsCheck(Loc& loc, DValue* arr, DValue* index, bool isslice)
{
@@ -1071,11 +981,9 @@ void DtoArrayBoundsCheck(Loc& loc, DValue* arr, DValue* index, bool isslice)
gIR->scope() = IRScope(failbb, okbb);
std::vector<LLValue*> args;
llvm::AttrListPtr palist;
// file param
args.push_back(gIR->dmodule->ir.irModule->fileName);
palist = palist.addAttr(1, llvm::Attribute::ByVal);
args.push_back(DtoLoad(gIR->dmodule->ir.irModule->fileName));
// line param
LLConstant* c = DtoConstUint(loc.linnum);
@@ -1084,12 +992,10 @@ void DtoArrayBoundsCheck(Loc& loc, DValue* arr, DValue* index, bool isslice)
// call
llvm::Function* errorfn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_array_bounds");
CallOrInvoke* call = gIR->CreateCallOrInvoke(errorfn, args.begin(), args.end());
call->setAttributes(palist);
// the function does not return
gIR->ir->CreateUnreachable();
// if ok, proceed in okbb
gIR->scope() = IRScope(okbb, oldend);
}

View File

@@ -43,6 +43,16 @@ LLValue* DVarValue::getRVal()
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
LLValue* DSliceValue::getRVal()
{
assert(len);
assert(ptr);
return DtoAggrPair(len, ptr);
}
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
DFuncValue::DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt)
{
func = fd;

View File

@@ -29,7 +29,6 @@ struct DVarValue;
struct DFieldValue;
struct DFuncValue;
struct DSliceValue;
struct DArrayLenValue;
struct DLRValue;
// base class for d-values
@@ -49,7 +48,6 @@ struct DValue : Object
virtual DFieldValue* isField() { return NULL; }
virtual DSliceValue* isSlice() { return NULL; }
virtual DFuncValue* isFunc() { return NULL; }
virtual DArrayLenValue* isArrayLen() { return NULL; }
virtual DLRValue* isLRValue() { return NULL; }
protected:
@@ -127,6 +125,8 @@ struct DSliceValue : DValue
DSliceValue(Type* t, LLValue* l, LLValue* p) { type=t; ptr=p; len=l; }
virtual LLValue* getRVal();
virtual Type*& getType() { assert(type); return type; }
virtual DSliceValue* isSlice() { return this; }
};

View File

@@ -59,7 +59,7 @@ const llvm::FunctionType* DtoFunctionType(Type* type, const LLType* thistype, co
{
const LLType* arrTy = DtoArrayType(LLType::Int8Ty);
const LLType* arrArrTy = DtoArrayType(arrTy);
paramvec.push_back(getPtrToType(arrArrTy));
paramvec.push_back(arrArrTy);
}
}
else{
@@ -103,7 +103,7 @@ const llvm::FunctionType* DtoFunctionType(Type* type, const LLType* thistype, co
types.push_back(DtoSize_t());
types.push_back(getPtrToType(getPtrToType(ti->ir.irStruct->constInit->getType())));
const LLType* t1 = llvm::StructType::get(types);
paramvec.push_back(getPtrToType(t1));
paramvec.push_back(t1);
paramvec.push_back(getPtrToType(LLType::Int8Ty));
}
else if (arrayVararg)
@@ -123,41 +123,37 @@ const llvm::FunctionType* DtoFunctionType(Type* type, const LLType* thistype, co
const LLType* at = DtoType(argT);
// FIXME: using the llvm type for these is a bad idea... aggregates are first class now and we're starting to use it ...
if (argT->iscomplex()) {
goto Lbadstuff;
}
else if (isaStruct(at)) {
Logger::println("struct param");
paramvec.push_back(getPtrToType(at));
if (!refOrOut)
arg->llvmAttrs |= llvm::Attribute::ByVal;
}
else if (isaArray(at)) {
// static array are passed by reference
Logger::println("sarray param");
assert(argT->ty == Tsarray);
paramvec.push_back(getPtrToType(at));
}
else if (llvm::isa<llvm::OpaqueType>(at)) {
// opaque types need special handling
if (llvm::isa<llvm::OpaqueType>(at)) {
Logger::println("opaque param");
assert(argT->ty == Tstruct || argT->ty == Tclass);
paramvec.push_back(getPtrToType(at));
}
// structs and delegates are passed as a reference, but by value
else if (argT->ty == Tstruct || argT->ty == Tdelegate) {
Logger::println("struct/sarray param");
if (!refOrOut)
arg->llvmAttrs |= llvm::Attribute::ByVal;
paramvec.push_back(getPtrToType(at));
}
// static arrays are passed directly by reference
else if (argT->ty == Tsarray)
{
Logger::println("static array param");
at = getPtrToType(at);
paramvec.push_back(at);
}
// firstclass ' ref/out ' parameter
else if (refOrOut) {
Logger::println("ref/out param");
at = getPtrToType(at);
paramvec.push_back(at);
}
// firstclass ' in ' parameter
else {
Lbadstuff:
if (refOrOut) {
Logger::println("by ref param");
at = getPtrToType(at);
}
else {
Logger::println("in param");
if (unsigned ea = DtoShouldExtend(argT))
{
arg->llvmAttrs |= ea;
}
}
Logger::println("in param");
if (unsigned ea = DtoShouldExtend(argT))
arg->llvmAttrs |= ea;
paramvec.push_back(at);
}
@@ -362,15 +358,6 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati
attrs.push_back(PAWI);
}
// set byval attrs on implicit main arg
if (fdecl->isMain() && Argument::dim(f->parameters) == 0)
{
PAWI.Index = llidx;
PAWI.Attrs = llvm::Attribute::ByVal;
attrs.push_back(PAWI);
llidx++;
}
// set attrs on the rest of the arguments
for (; llidx <= funcNumArgs && Argument::dim(f->parameters) > k; ++llidx,++k)
{
@@ -775,12 +762,18 @@ void DtoDefineFunc(FuncDeclaration* fd)
}
}
// copy _argptr to a memory location
// copy _argptr and _arguments to a memory location
if (f->linkage == LINKd && f->varargs == 1)
{
// _argptr
LLValue* argptrmem = DtoAlloca(fd->ir.irFunc->_argptr->getType(), "_argptr_mem");
new llvm::StoreInst(fd->ir.irFunc->_argptr, argptrmem, gIR->scopebb());
fd->ir.irFunc->_argptr = argptrmem;
// _arguments
LLValue* argumentsmem = DtoAlloca(fd->ir.irFunc->_arguments->getType(), "_arguments_mem");
new llvm::StoreInst(fd->ir.irFunc->_arguments, argumentsmem, gIR->scopebb());
fd->ir.irFunc->_arguments = argumentsmem;
}
// output function body

View File

@@ -117,35 +117,14 @@ void DtoAssert(Loc* loc, DValue* msg)
const char* fname = msg ? "_d_assert_msg" : "_d_assert";
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname);
// param attrs
llvm::AttrListPtr palist;
int idx = 1;
// msg param
if (msg)
{
if (DSliceValue* s = msg->isSlice())
{
llvm::AllocaInst* alloc = gIR->func()->msgArg;
if (!alloc)
{
alloc = DtoAlloca(DtoArrayType(LLType::Int8Ty), ".assertmsg");
DtoSetArray(alloc, DtoArrayLen(s), DtoArrayPtr(s));
gIR->func()->msgArg = alloc;
}
args.push_back(alloc);
}
else
{
args.push_back(msg->getRVal());
}
palist = palist.addAttr(idx++, llvm::Attribute::ByVal);
args.push_back(msg->getRVal());
}
// file param
args.push_back(gIR->dmodule->ir.irModule->fileName);
palist = palist.addAttr(idx++, llvm::Attribute::ByVal);
args.push_back(DtoLoad(gIR->dmodule->ir.irModule->fileName));
// line param
LLConstant* c = DtoConstUint(loc->linnum);
@@ -153,7 +132,10 @@ void DtoAssert(Loc* loc, DValue* msg)
// call
CallOrInvoke* call = gIR->CreateCallOrInvoke(fn, args.begin(), args.end());
call->setAttributes(palist);
// end debug info
if (global.params.symdebug)
DtoDwarfFuncEnd(gIR->func()->decl);
// after assert is always unreachable
gIR->ir->CreateUnreachable();
@@ -445,8 +427,12 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs)
DtoSetArrayToNull(lhs->getLVal());
}
// reference assignment
else if (t2->ty == Tarray) {
DtoStore(rhs->getRVal(), lhs->getLVal());
}
// some implicitly converting ref assignment
else {
DtoArrayAssign(lhs->getLVal(), rhs->getRVal());
DtoSetArray(lhs->getLVal(), DtoArrayLen(rhs), DtoArrayPtr(rhs));
}
}
else if (t->ty == Tsarray) {
@@ -756,6 +742,52 @@ DValue* DtoCast(Loc& loc, DValue* val, Type* to)
}
}
//////////////////////////////////////////////////////////////////////////////////////////
DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
{
Type* from = val->getType()->toBasetype();
Logger::println("repainting from '%s' to '%s'", from->toChars(), to->toChars());
if (from->ty == Tarray)
{
Type* at = to->toBasetype();
assert(at->ty == Tarray);
Type* elem = at->next->pointerTo();
if (DSliceValue* slice = val->isSlice())
{
return new DSliceValue(to, slice->len, DtoBitCast(slice->ptr, DtoType(elem)));
}
else if (val->isLVal())
{
LLValue* ptr = val->getLVal();
ptr = DtoBitCast(ptr, DtoType(at->pointerTo()));
return new DVarValue(to, ptr);
}
else
{
LLValue *len, *ptr;
len = DtoArrayLen(val);
ptr = DtoArrayPtr(val);
ptr = DtoBitCast(ptr, DtoType(elem));
return new DImValue(to, DtoAggrPair(len, ptr, "tmp"));
}
}
else if (from->ty == Tpointer || from->ty == Tclass || from->ty == Taarray)
{
Type* b = to->toBasetype();
assert(b->ty == Tpointer || b->ty == Tclass || b->ty == Taarray);
LLValue* ptr = DtoBitCast(val->getRVal(), DtoType(b));
return new DImValue(to, ptr);
}
else
{
assert(!val->isLVal());
assert(DtoType(to) == DtoType(to));
return new DImValue(to, val->getRVal());
}
}
/****************************************************************************************/
/*////////////////////////////////////////////////////////////////////////////////////////
// TEMPLATE HELPERS
@@ -1413,7 +1445,7 @@ DValue* DtoInitializer(LLValue* target, Initializer* init)
static LLConstant* expand_to_sarray(Type *base, Expression* exp)
{
Logger::println("building type %s from expression (%s) of type %s", base->toChars(), exp->toChars(), exp->type->toChars());
Logger::println("building type %s to expression (%s) of type %s", base->toChars(), exp->toChars(), exp->type->toChars());
const LLType* dstTy = DtoType(base);
if (Logger::enabled())
Logger::cout() << "final llvm type requested: " << *dstTy << '\n';
@@ -1463,12 +1495,12 @@ LLConstant* DtoDefaultInit(Type* type)
{
if (base->ty == Tsarray)
{
Logger::println("type is a static array, building constant array initializer from single value");
Logger::println("type is a static array, building constant array initializer to single value");
return expand_to_sarray(base, exp);
}
else
{
error("cannot yet convert default initializer %s from type %s to %s", exp->toChars(), exp->type->toChars(), type->toChars());
error("cannot yet convert default initializer %s to type %s to %s", exp->toChars(), exp->type->toChars(), type->toChars());
fatal();
}
assert(0);

View File

@@ -58,6 +58,9 @@ DValue* DtoCastFloat(Loc& loc, DValue* val, Type* to);
DValue* DtoCastDelegate(Loc& loc, DValue* val, Type* to);
DValue* DtoCast(Loc& loc, DValue* val, Type* to);
// return the same val as passed in, modified to the target type, if possible, otherwise returns a new DValue
DValue* DtoPaintType(Loc& loc, DValue* val, Type* to);
// is template instance check
bool DtoIsTemplateInstance(Dsymbol* s);

View File

@@ -110,18 +110,7 @@ static const LLType* rt_ptr(const LLType* t)
static const LLType* rt_array(const LLType* elemty)
{
std::vector<const LLType*> t;
t.push_back(DtoSize_t());
t.push_back(rt_ptr(elemty));
return rt_ptr(llvm::StructType::get(t));
}
static const LLType* rt_array2(const LLType* elemty)
{
std::vector<const LLType*> t;
t.push_back(DtoSize_t());
t.push_back(rt_ptr(elemty));
return llvm::StructType::get(t);
return llvm::StructType::get(DtoSize_t(), rt_ptr(elemty), 0);
}
static const LLType* rt_dg1()
@@ -199,11 +188,9 @@ static void LLVM_D_BuildRuntimeModule()
types.push_back(stringTy);
types.push_back(intTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M);
}
// void _d_assert_msg( char[] msg, char[] file, uint line )
@@ -214,10 +201,7 @@ static void LLVM_D_BuildRuntimeModule()
types.push_back(stringTy);
types.push_back(intTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
/////////////////////////////////////////////////////////////////////////////////////
@@ -382,7 +366,6 @@ static void LLVM_D_BuildRuntimeModule()
types.push_back(rt_dg1()); \
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
llvm::AttrListPtr palist; \
palist = palist.addAttr(1, llvm::Attribute::ByVal); \
palist = palist.addAttr(2, llvm::Attribute::ByVal); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist); \
@@ -402,7 +385,6 @@ static void LLVM_D_BuildRuntimeModule()
types.push_back(rt_dg2()); \
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
llvm::AttrListPtr palist; \
palist = palist.addAttr(1, llvm::Attribute::ByVal); \
palist = palist.addAttr(2, llvm::Attribute::ByVal); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist); \
@@ -421,7 +403,6 @@ static void LLVM_D_BuildRuntimeModule()
types.push_back(rt_dg1()); \
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
llvm::AttrListPtr palist; \
palist = palist.addAttr(1, llvm::Attribute::ByVal); \
palist = palist.addAttr(2, llvm::Attribute::ByVal); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist); \
@@ -440,7 +421,6 @@ static void LLVM_D_BuildRuntimeModule()
types.push_back(rt_dg2()); \
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); \
llvm::AttrListPtr palist; \
palist = palist.addAttr(1, llvm::Attribute::ByVal); \
palist = palist.addAttr(2, llvm::Attribute::ByVal); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist); \
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist); \
@@ -470,22 +450,6 @@ static void LLVM_D_BuildRuntimeModule()
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
// builds the d string[] for the D main args from the C main args
// void _d_main_args(uint n, char** args, ref char[][] res)
{
std::string fname("_d_main_args");
std::vector<const LLType*> types;
types.push_back(intTy);
types.push_back(rt_ptr(rt_ptr(byteTy)));
types.push_back(rt_array(stringTy->getContainedType(0)));
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
// cast to object
// Object _d_toObject(void* p)
{
@@ -529,12 +493,9 @@ static void LLVM_D_BuildRuntimeModule()
std::string fname2("_adSortChar");
std::vector<const LLType*> types;
types.push_back(stringTy);
types.push_back(stringTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist);
const llvm::FunctionType* fty = llvm::FunctionType::get(stringTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
}
// wchar[] _adReverseWchar(wchar[] a)
@@ -544,42 +505,33 @@ static void LLVM_D_BuildRuntimeModule()
std::string fname2("_adSortWchar");
std::vector<const LLType*> types;
types.push_back(wstringTy);
types.push_back(wstringTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist);
const llvm::FunctionType* fty = llvm::FunctionType::get(wstringTy, types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
}
// Array _adReverse(Array a, size_t szelem)
// void[] _adReverse(void[] a, size_t szelem)
{
std::string fname("_adReverse");
std::vector<const LLType*> types;
types.push_back(rt_array(byteTy));
types.push_back(rt_array(byteTy));
types.push_back(sizeTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// Array _adDupT(TypeInfo ti, Array a)
// void[] _adDupT(TypeInfo ti, void[] a)
{
std::string fname("_adDupT");
std::vector<const LLType*> types;
types.push_back(rt_array(byteTy));
types.push_back(typeInfoTy);
types.push_back(rt_array(byteTy));
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(3, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// int _adEq(Array a1, Array a2, TypeInfo ti)
// int _adCmp(Array a1, Array a2, TypeInfo ti)
// int _adEq(void[] a1, void[] a2, TypeInfo ti)
// int _adCmp(void[] a1, void[] a2, TypeInfo ti)
{
std::string fname("_adEq");
std::string fname2("_adCmp");
@@ -588,37 +540,28 @@ static void LLVM_D_BuildRuntimeModule()
types.push_back(rt_array(byteTy));
types.push_back(typeInfoTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M);
}
// int _adCmpChar(Array a1, Array a2)
// int _adCmpChar(void[] a1, void[] a2)
{
std::string fname("_adCmpChar");
std::vector<const LLType*> types;
types.push_back(rt_array(byteTy));
types.push_back(rt_array(byteTy));
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// Array _adSort(Array a, TypeInfo ti)
// void[] _adSort(void[] a, TypeInfo ti)
{
std::string fname("_adSort");
std::vector<const LLType*> types;
types.push_back(rt_array(byteTy));
types.push_back(rt_array(byteTy));
types.push_back(typeInfoTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
/////////////////////////////////////////////////////////////////////////////////////
@@ -680,15 +623,14 @@ static void LLVM_D_BuildRuntimeModule()
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// ArrayRet_t _aaValues(AA aa, size_t keysize, size_t valuesize)
// void[] _aaValues(AA aa, size_t keysize, size_t valuesize)
{
std::string fname("_aaValues");
std::vector<const LLType*> types;
types.push_back(rt_array(byteTy));
types.push_back(aaTy);
types.push_back(sizeTy);
types.push_back(sizeTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
@@ -702,14 +644,13 @@ static void LLVM_D_BuildRuntimeModule()
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// ArrayRet_t _aaKeys(AA aa, size_t keysize)
// void[] _aaKeys(AA aa, size_t keysize)
{
std::string fname("_aaKeys");
std::vector<const LLType*> types;
types.push_back(rt_array(byteTy));
types.push_back(aaTy);
types.push_back(sizeTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
const llvm::FunctionType* fty = llvm::FunctionType::get(rt_array(byteTy), types, false);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
@@ -732,7 +673,7 @@ static void LLVM_D_BuildRuntimeModule()
std::vector<const LLType*> types;
types.push_back(aaTy);
types.push_back(sizeTy);
types.push_back(rt_dg1());
types.push_back(rt_dg2());
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(3, llvm::Attribute::ByVal);
@@ -808,39 +749,30 @@ static void LLVM_D_BuildRuntimeModule()
{
std::string fname("_d_switch_string");
std::vector<const LLType*> types;
types.push_back(rt_array(rt_array2(byteTy)));
types.push_back(rt_array(stringTy));
types.push_back(stringTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// int _d_switch_ustring(wchar[][] table, wchar[] ca)
{
std::string fname("_d_switch_ustring");
std::vector<const LLType*> types;
types.push_back(rt_array(rt_array2(shortTy)));
types.push_back(rt_array(wstringTy));
types.push_back(wstringTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
// int _d_switch_dstring(dchar[][] table, dchar[] ca)
{
std::string fname("_d_switch_dstring");
std::vector<const LLType*> types;
types.push_back(rt_array(rt_array2(intTy)));
types.push_back(rt_array(dstringTy));
types.push_back(dstringTy);
const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false);
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M)->setAttributes(palist);
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
}
/////////////////////////////////////////////////////////////////////////////////////

View File

@@ -676,7 +676,7 @@ struct Case : Object
}
};
static LLValue* call_string_switch_runtime(llvm::GlobalVariable* table, Expression* e)
static LLValue* call_string_switch_runtime(llvm::Value* table, Expression* e)
{
Type* dt = e->type->toBasetype();
Type* dtnext = dt->next->toBasetype();
@@ -705,27 +705,11 @@ static LLValue* call_string_switch_runtime(llvm::GlobalVariable* table, Expressi
assert(table->getType() == fn->getFunctionType()->getParamType(0));
DValue* val = e->toElem(gIR);
LLValue* llval;
if (DSliceValue* sval = val->isSlice())
{
// give storage
llval = DtoAlloca(DtoType(e->type), "tmp");
DVarValue* vv = new DVarValue(e->type, llval);
DtoAssign(e->loc, vv, val);
}
else
{
llval = val->getRVal();
}
LLValue* llval = val->getRVal();
assert(llval->getType() == fn->getFunctionType()->getParamType(1));
CallOrInvoke* call = gIR->CreateCallOrInvoke2(fn, table, llval, "tmp");
llvm::AttrListPtr palist;
palist = palist.addAttr(1, llvm::Attribute::ByVal);
palist = palist.addAttr(2, llvm::Attribute::ByVal);
call->setAttributes(palist);
return call->get();
}
@@ -748,7 +732,7 @@ void SwitchStatement::toIR(IRState* p)
}
// string switch?
llvm::GlobalVariable* switchTable = 0;
llvm::Value* switchTable = 0;
Array caseArray;
if (!condition->type->isintegral())
{
@@ -790,9 +774,7 @@ void SwitchStatement::toIR(IRState* p)
std::vector<LLConstant*> sinits;
sinits.push_back(DtoConstSize_t(inits.size()));
sinits.push_back(arrPtr);
LLConstant* sInit = llvm::ConstantStruct::get(sTy, sinits);
switchTable = new llvm::GlobalVariable(sTy, true, llvm::GlobalValue::InternalLinkage, sInit, ".string_switch_table", gIR->module);
switchTable = llvm::ConstantStruct::get(sTy, sinits);
}
// body block
@@ -1173,7 +1155,16 @@ void WithStatement::toIR(IRState* p)
DValue* e = exp->toElem(p);
#if 1
// this doesn't handle the mini/with2.d test case ...
assert(!wthis->ir.isSet());
wthis->ir.irLocal = new IrLocal(wthis);
wthis->ir.irLocal->value = DtoAlloca(DtoType(wthis->type), wthis->toChars());
#else
// ... this does, but it also silently breaks MiniD!!!
DtoDeclarationExp(wthis);
#endif
DtoStore(e->getRVal(), wthis->ir.irLocal->value);
body->toIR(p);
@@ -1269,15 +1260,10 @@ void SwitchErrorStatement::toIR(IRState* p)
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_switch_error");
// param attrs
llvm::AttrListPtr palist;
int idx = 1;
std::vector<LLValue*> args;
// file param
args.push_back(gIR->dmodule->ir.irModule->fileName);
palist = palist.addAttr(idx++, llvm::Attribute::ByVal);
args.push_back(DtoLoad(gIR->dmodule->ir.irModule->fileName));
// line param
LLConstant* c = DtoConstUint(loc.linnum);
@@ -1285,7 +1271,6 @@ void SwitchErrorStatement::toIR(IRState* p)
// call
CallOrInvoke* call = gIR->CreateCallOrInvoke(fn, args.begin(), args.end());
call->setAttributes(palist);
gIR->ir->CreateUnreachable();
}

View File

@@ -175,7 +175,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args, llvm::AttrListPtr& palist,
true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array", gIR->module);
// specify arguments
args.push_back(typeinfoarrayparam);
args.push_back(DtoLoad(typeinfoarrayparam));
++argidx;
args.push_back(gIR->ir->CreateBitCast(mem, getPtrToType(LLType::Int8Ty), "tmp"));
++argidx;
@@ -319,11 +319,11 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
LLValue* arg = argval->getRVal();
if (fnarg) // can fnarg ever be null in this block?
{
// if (Logger::enabled())
// {
// Logger::cout() << "arg: " << *arg << '\n';
// Logger::cout() << "expects: " << *callableTy->getParamType(j) << '\n';
// }
if (Logger::enabled())
{
Logger::cout() << "arg: " << *arg << '\n';
Logger::cout() << "expects: " << *callableTy->getParamType(j) << '\n';
}
if (arg->getType() != callableTy->getParamType(j))
arg = DtoBitCast(arg, callableTy->getParamType(j));
if (fnarg->llvmAttrs)
@@ -355,9 +355,33 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
// get return value
LLValue* retllval = (retinptr) ? args[0] : call->get();
// if the type of retllval is abstract, refine to concrete
if (retllval->getType()->isAbstract())
retllval = DtoBitCast(retllval, getPtrToType(DtoType(resulttype)), "retval");
// repaint the type if necessary
if (resulttype)
{
Type* rbase = resulttype->toBasetype();
Type* nextbase = tf->next->toBasetype();
if (!rbase->equals(nextbase))
{
Logger::println("repainting return value from '%s' to '%s'", tf->next->toChars(), rbase->toChars());
switch(rbase->ty)
{
case Tarray:
retllval = DtoAggrPaint(retllval, DtoType(rbase));
break;
case Tclass:
case Taarray:
case Tpointer:
retllval = DtoBitCast(retllval, DtoType(rbase));
break;
default:
assert(0 && "unhandled repainting of return value");
}
if (Logger::enabled())
Logger::cout() << "final return value: " << *retllval << '\n';
}
}
// set calling convention and parameter attributes
if (dfnval && dfnval->func)

View File

@@ -783,21 +783,26 @@ DValue* CastExp::toElem(IRState* p)
Logger::print("CastExp::toElem: %s | %s\n", toChars(), type->toChars());
LOG_SCOPE;
// get the value to cast
DValue* u = e1->toElem(p);
DValue* v = DtoCast(loc, u, to);
// force d type to this->type
v->getType() = type;
if (v->isSlice()) {
// only valid as rvalue!
// cast it to the 'to' type, if necessary
DValue* v = u;
if (!to->equals(e1->type))
v = DtoCast(loc, u, to);
// paint the type, if necessary
if (!type->equals(to))
v = DtoPaintType(loc, v, type);
// slices are not valid lvalues
if (v->isSlice())
return v;
}
// if we're casting a lvalue, keep it around, we might be in a lvalue cast.
else if(u->isLVal())
return new DLRValue(u, v);
else
return v;
// otherwise just return the new value
return v;
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -811,7 +816,7 @@ LLConstant* CastExp::toConstElem(IRState* p)
const LLType* lltype = DtoType(type);
if(!isaPointer(c->getType()) || !isaPointer(lltype)) {
error("can only cast pointers to pointers at compile time, not %s to %s", type->toChars(), e1->type->toChars());
error("can only cast pointers to pointers at code generation time, not %s to %s", type->toChars(), e1->type->toChars());
fatal();
}
@@ -1552,8 +1557,8 @@ DValue* DeleteExp::toElem(IRState* p)
else if (et->ty == Tarray)
{
DtoDeleteArray(dval);
if (!dval->isSlice())
DtoSetArrayToNull(dval->getRVal());
if (dval->isLVal())
DtoSetArrayToNull(dval->getLVal());
}
// unknown/invalid
else

View File

@@ -25,14 +25,14 @@ bool DtoIsPassedByRef(Type* type)
{
Type* typ = type->toBasetype();
TY t = typ->ty;
return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray);
return (t == Tstruct || t == Tdelegate || t == Tsarray);
}
bool DtoIsReturnedInArg(Type* type)
{
Type* typ = type->toBasetype();
TY t = typ->ty;
return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray);
return (t == Tstruct || t == Tdelegate || t == Tsarray);
}
unsigned DtoShouldExtend(Type* type)
@@ -179,9 +179,6 @@ const LLType* DtoType(Type* t)
return DtoStructTypeFromArguments(ttupl->arguments);
}
*/
// opaque type
case Topaque:
return llvm::OpaqueType::get();
default:
printf("trying to convert unknown type '%s' with value %d\n", t->toChars(), t->ty);
@@ -560,6 +557,8 @@ LLConstant* DtoConstStringPtr(const char* str, const char* section)
LLValue* DtoLoad(LLValue* src, const char* name)
{
if (Logger::enabled())
Logger::cout() << "loading " << *src << '\n';
LLValue* ld = gIR->ir->CreateLoad(src, name ? name : "tmp");
//ld->setVolatile(gIR->func()->inVolatile);
return ld;
@@ -567,6 +566,8 @@ LLValue* DtoLoad(LLValue* src, const char* name)
void DtoStore(LLValue* src, LLValue* dst)
{
if (Logger::enabled())
Logger::cout() << "storing " << *src << " into " << *dst << '\n';
LLValue* st = gIR->ir->CreateStore(src,dst);
//st->setVolatile(gIR->func()->inVolatile);
}
@@ -577,6 +578,7 @@ LLValue* DtoBitCast(LLValue* v, const LLType* t, const char* name)
{
if (v->getType() == t)
return v;
assert(!(isaStruct(t) || isaStruct(v->getType())));
return gIR->ir->CreateBitCast(v, t, name ? name : "tmp");
}
@@ -806,3 +808,25 @@ LLValue* DtoAggrPair(const LLType* type, LLValue* V1, LLValue* V2, const char* n
res = gIR->ir->CreateInsertValue(res, V1, 0, "tmp");
return gIR->ir->CreateInsertValue(res, V2, 1, name?name:"tmp");
}
LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name)
{
const LLType* t = LLStructType::get(V1->getType(), V2->getType(), 0);
return DtoAggrPair(t, V1, V2, name);
}
LLValue* DtoAggrPaint(LLValue* aggr, const LLType* as)
{
if (aggr->getType() == as)
return aggr;
LLValue* res = llvm::UndefValue::get(as);
LLValue* V = gIR->ir->CreateExtractValue(aggr, 0, "tmp");;
V = DtoBitCast(V, as->getContainedType(0));
res = gIR->ir->CreateInsertValue(res, V, 0, "tmp");
V = gIR->ir->CreateExtractValue(aggr, 1, "tmp");;
V = DtoBitCast(V, as->getContainedType(1));
return gIR->ir->CreateInsertValue(res, V, 1, "tmp");
}

View File

@@ -98,6 +98,8 @@ unsigned char getPrefTypeAlign(const LLType* t);
// pair type helpers
LLValue* DtoAggrPair(const LLType* type, LLValue* V1, LLValue* V2, const char* name = 0);
LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name = 0);
LLValue* DtoAggrPaint(LLValue* aggr, const LLType* as);
/**
* Generates a call to llvm.memset.i32 (or i64 depending on architecture).

View File

@@ -75,7 +75,7 @@ void Module::genobjfile(int multiobj, char** envp)
Logger::println("Generating module: %s\n", (md ? md->toChars() : toChars()));
LOG_SCOPE;
// printf("codegen: %s\n", srcfile->toChars());
//printf("codegen: %s\n", srcfile->toChars());
// start by deleting the old object file
deleteObjFile();

View File

@@ -36,6 +36,12 @@
private import util.utf;
//debug = apply;
debug(apply)
{
extern(C) int printf(char*, ...);
}
/**********************************************
*/
@@ -356,6 +362,7 @@ extern (C) int _aApplydc2(dchar[] aa, dg2_t dg)
char c;
d = aa[i];
debug(apply) printf("d = %u\n", d);
if (d & ~0x7F)
{
char[4] buf;
@@ -363,6 +370,7 @@ extern (C) int _aApplydc2(dchar[] aa, dg2_t dg)
auto b = toUTF8(buf, d);
foreach (char c2; b)
{
debug(apply) printf("c2 = %d\n", c2);
result = dg(&i, cast(void *)&c2);
if (result)
return result;

View File

@@ -63,13 +63,6 @@ static size_t[] prime_list = [
// 8_589_934_513UL, 17_179_869_143UL
];
// This is the type of the return value for dynamic arrays.
struct Array
{
size_t length;
void* ptr;
}
struct aaA
{
aaA *left;
@@ -449,7 +442,7 @@ void _aaDel(AA aa, TypeInfo keyti, void *pkey)
* Produce array of values from aa.
*/
Array _aaValues(AA aa, size_t keysize, size_t valuesize)
void[] _aaValues(AA aa, size_t keysize, size_t valuesize)
in
{
assert(keysize == aligntsize(keysize));
@@ -457,7 +450,7 @@ in
body
{
size_t resi;
Array a;
void[] a;
void _aaValues_x(aaA* e)
{
@@ -480,9 +473,10 @@ body
if (aa)
{
a.length = _aaLen(aa);
a.ptr = cast(byte*) gc_malloc(a.length * valuesize,
auto len = _aaLen(aa);
auto ptr = cast(byte*) gc_malloc(len * valuesize,
valuesize < (void*).sizeof ? BlkAttr.NO_SCAN : 0);
a = ptr[0 .. len];
resi = 0;
foreach (e; aa.b)
{
@@ -593,7 +587,7 @@ body
* Produce array of N byte keys from aa.
*/
Array _aaKeys(AA aa, size_t keysize)
void[] _aaKeys(AA aa, size_t keysize)
{
byte[] res;
size_t resi;
@@ -617,7 +611,7 @@ Array _aaKeys(AA aa, size_t keysize)
auto len = _aaLen(aa);
if (!len)
return Array();
return null;
res = (cast(byte*) gc_malloc(len * keysize,
!(aa.keyti.flags() & 1) ? BlkAttr.NO_SCAN : 0)) [0 .. len * keysize];
resi = 0;
@@ -628,7 +622,7 @@ Array _aaKeys(AA aa, size_t keysize)
}
assert(resi == len);
return Array(len, res.ptr);
return res.ptr[0 .. len];
}

View File

@@ -55,12 +55,6 @@ private
}
struct Array
{
size_t length;
void* ptr;
}
/**********************************************
* Reverse array of chars.
* Handled separately because embedded multibyte encodings should not be
@@ -92,6 +86,9 @@ extern (C) char[] _adReverseChar(char[] a)
}
uint stridelo = UTF8stride[clo];
// don't barf on invalid strides, just ignore it
if (stridelo == 0xFF)
stridelo = 1;
uint stridehi = 1;
while ((chi & 0xC0) == 0x80)
@@ -245,7 +242,7 @@ unittest
* Support for array.reverse property.
*/
extern (C) Array _adReverse(Array a, size_t szelem)
extern (C) void[] _adReverse(void[] a, size_t szelem)
out (result)
{
assert(result.ptr is a.ptr);
@@ -287,7 +284,7 @@ extern (C) Array _adReverse(Array a, size_t szelem)
//gc_free(tmp);
}
}
return Array(a.length, a.ptr);
return a.ptr[0 .. a.length];
}
unittest
@@ -375,7 +372,7 @@ extern (C) wchar[] _adSortWchar(wchar[] a)
* Support for array equality test.
*/
extern (C) int _adEq(Array a1, Array a2, TypeInfo ti)
extern (C) int _adEq(void[] a1, void[] a2, TypeInfo ti)
{
debug(adi) printf("_adEq(a1.length = %d, a2.length = %d)\n", a1.length, a2.length);
@@ -405,7 +402,7 @@ unittest
* Support for array compare test.
*/
extern (C) int _adCmp(Array a1, Array a2, TypeInfo ti)
extern (C) int _adCmp(void[] a1, void[] a2, TypeInfo ti)
{
debug(adi) printf("adCmp()\n");
@@ -442,7 +439,7 @@ unittest
* Support for array compare test.
*/
extern (C) int _adCmpChar(Array a1, Array a2)
extern (C) int _adCmpChar(void[] a1, void[] a2)
{
version(D_InlineAsm_X86)
{

View File

@@ -64,7 +64,8 @@ LIB_DEST=..
targets : lib sharedlib doc
all : lib sharedlib doc
lib : ldc.bclib ldc.clib ldc.lib
#lib : ldc.bclib ldc.clib ldc.lib
lib : ldc.clib ldc.lib
sharedlib : ldc.sharedlib
doc : ldc.doc
@@ -218,14 +219,14 @@ ALL_DOCS=
######################################################
ldc.bclib : $(LIB_TARGET_BC_ONLY)
#ldc.bclib : $(LIB_TARGET_BC_ONLY)
ldc.clib : $(LIB_TARGET_C_ONLY)
ldc.lib : $(LIB_TARGET_FULL)
ldc.sharedlib : $(LIB_TARGET_SHARED)
$(LIB_TARGET_BC_ONLY) : $(ALL_OBJS_O)
$(RM) $@
$(LC) $@ $(ALL_OBJS_BC)
#$(LIB_TARGET_BC_ONLY) : $(ALL_OBJS_O)
# $(RM) $@
# $(LC) $@ $(ALL_OBJS_BC)
$(LIB_TARGET_FULL) : $(ALL_OBJS_O)
@@ -250,7 +251,7 @@ ldc.doc : $(ALL_DOCS)
clean :
find . -name "*.di" | xargs $(RM)
$(RM) $(ALL_OBJS_BC)
# $(RM) $(ALL_OBJS_BC)
$(RM) $(ALL_OBJS_O)
$(RM) $(ALL_DOCS)
$(RM) $(LIB_MASK)

View File

@@ -1092,17 +1092,12 @@ extern (C) void* _d_arrayliteralT(TypeInfo ti, size_t length, ...)
/**
* Support for array.dup property.
*/
struct Array2
{
size_t length;
void* ptr;
}
/**
*
*/
extern (C) Array2 _adDupT(TypeInfo ti, Array2 a)
extern (C) void[] _adDupT(TypeInfo ti, void[] a)
out (result)
{
auto sizeelem = ti.next.tsize(); // array element size
@@ -1110,17 +1105,16 @@ out (result)
}
body
{
Array2 r;
void* ptr;
if (a.length)
{
auto sizeelem = ti.next.tsize(); // array element size
auto size = a.length * sizeelem;
r.ptr = gc_malloc(size, !(ti.next.flags() & 1) ? BlkAttr.NO_SCAN : 0);
r.length = a.length;
memcpy(r.ptr, a.ptr, size);
ptr = gc_malloc(size, !(ti.next.flags() & 1) ? BlkAttr.NO_SCAN : 0);
memcpy(ptr, a.ptr, size);
}
return r;
return ptr[0 .. a.length];
}

View File

@@ -17,12 +17,6 @@
private import tango.stdc.stdlib;
struct Array
{
size_t length;
void* ptr;
}
private TypeInfo tiglobal;
extern (C) int cmp(void* p1, void* p2)
@@ -30,7 +24,7 @@ extern (C) int cmp(void* p1, void* p2)
return tiglobal.compare(p1, p2);
}
extern (C) Array _adSort(Array a, TypeInfo ti)
extern (C) void[] _adSort(void[] a, TypeInfo ti)
{
synchronized
{

View File

@@ -1,4 +1,4 @@
module foreach6;
module mini.foreach6;
struct S
{

View File

@@ -1,9 +1,10 @@
module tangotests.foreach1;
module mini.foreach8;
extern(C) int printf(char*, ...);
int main(){
dchar[] array="\u2260";
printf("array[0] == %u\n", array[0]);
int test=0;
int count=0;
assert(count==0);