Mercurial > projects > ldc
comparison dmd/mtype.c @ 1009:b1b23a64ad8c
Use LLVM alignment data instead of hand-picked.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sat, 28 Feb 2009 16:09:44 +0100 |
parents | 4c20df3837f9 |
children | 47f8b54f90b3 |
comparison
equal
deleted
inserted
replaced
1008:4c20df3837f9 | 1009:b1b23a64ad8c |
---|---|
62 #include "id.h" | 62 #include "id.h" |
63 #include "enum.h" | 63 #include "enum.h" |
64 #include "import.h" | 64 #include "import.h" |
65 #include "aggregate.h" | 65 #include "aggregate.h" |
66 #include "hdrgen.h" | 66 #include "hdrgen.h" |
67 | |
68 #include "gen/tollvm.h" | |
67 | 69 |
68 FuncDeclaration *hasThis(Scope *sc); | 70 FuncDeclaration *hasThis(Scope *sc); |
69 | 71 |
70 | 72 |
71 #define LOGDOTEXP 0 // log ::dotExp() | 73 #define LOGDOTEXP 0 // log ::dotExp() |
997 //printf("TypeBasic::size() = %d\n", size); | 999 //printf("TypeBasic::size() = %d\n", size); |
998 return size; | 1000 return size; |
999 } | 1001 } |
1000 | 1002 |
1001 unsigned TypeBasic::alignsize() | 1003 unsigned TypeBasic::alignsize() |
1002 { unsigned sz; | 1004 { |
1003 | 1005 return getABITypeAlign(DtoType(this)); |
1004 //LDC: it's bad that we always have to check LLVM's align and | |
1005 // dmd's align info match. Can't we somehow get at LLVM's align | |
1006 // here? | |
1007 | |
1008 switch (ty) | |
1009 { | |
1010 case Tfloat80: | |
1011 case Timaginary80: | |
1012 case Tcomplex80: | |
1013 if (global.params.cpu == ARCHx86_64) | |
1014 sz = 16; | |
1015 else | |
1016 sz = 4; | |
1017 break; | |
1018 | |
1019 case Tint64: | |
1020 case Tuns64: | |
1021 case Tfloat64: | |
1022 case Timaginary64: | |
1023 case Tcomplex64: | |
1024 if (global.params.cpu == ARCHx86_64) | |
1025 sz = 8; | |
1026 else | |
1027 sz = 4; | |
1028 break; | |
1029 | |
1030 case Tcomplex32: | |
1031 sz = 4; | |
1032 break; | |
1033 | |
1034 default: | |
1035 sz = size(0); | |
1036 break; | |
1037 } | |
1038 return sz; | |
1039 } | 1006 } |
1040 | 1007 |
1041 | 1008 |
1042 Expression *TypeBasic::getProperty(Loc loc, Identifier *ident) | 1009 Expression *TypeBasic::getProperty(Loc loc, Identifier *ident) |
1043 { | 1010 { |