Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 1147:dbe4af57b240
Changed use of toObjFile to a new codegen method.
More versioning of DMD specific codegen code.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 27 Mar 2009 17:54:27 +0100 |
parents | 40caa8207b3e |
children | 3d1b16dabd25 |
comparison
equal
deleted
inserted
replaced
1146:1860414bf3b7 | 1147:dbe4af57b240 |
---|---|
977 } | 977 } |
978 } | 978 } |
979 | 979 |
980 ////////////////////////////////////////////////////////////////////////////////////////// | 980 ////////////////////////////////////////////////////////////////////////////////////////// |
981 | 981 |
982 void DtoEmptyResolveList() | |
983 { | |
984 //Logger::println("DtoEmptyResolveList()"); | |
985 Dsymbol* dsym; | |
986 while (!gIR->resolveList.empty()) { | |
987 dsym = gIR->resolveList.front(); | |
988 gIR->resolveList.pop_front(); | |
989 DtoResolveDsymbol(dsym); | |
990 } | |
991 } | |
992 | |
993 ////////////////////////////////////////////////////////////////////////////////////////// | |
994 | |
995 void DtoEmptyDeclareList() | |
996 { | |
997 //Logger::println("DtoEmptyDeclareList()"); | |
998 Dsymbol* dsym; | |
999 while (!gIR->declareList.empty()) { | |
1000 dsym = gIR->declareList.front(); | |
1001 gIR->declareList.pop_front(); | |
1002 DtoDeclareDsymbol(dsym); | |
1003 } | |
1004 } | |
1005 | |
1006 ////////////////////////////////////////////////////////////////////////////////////////// | |
1007 | |
1008 void DtoEmptyConstInitList() | |
1009 { | |
1010 //Logger::println("DtoEmptyConstInitList()"); | |
1011 Dsymbol* dsym; | |
1012 while (!gIR->constInitList.empty()) { | |
1013 dsym = gIR->constInitList.front(); | |
1014 gIR->constInitList.pop_front(); | |
1015 DtoConstInitDsymbol(dsym); | |
1016 } | |
1017 } | |
1018 | |
1019 ////////////////////////////////////////////////////////////////////////////////////////// | |
1020 | |
1021 void DtoEmptyDefineList() | |
1022 { | |
1023 //Logger::println("DtoEmptyDefineList()"); | |
1024 Dsymbol* dsym; | |
1025 while (!gIR->defineList.empty()) { | |
1026 dsym = gIR->defineList.front(); | |
1027 gIR->defineList.pop_front(); | |
1028 DtoDefineDsymbol(dsym); | |
1029 } | |
1030 } | |
1031 | |
1032 ////////////////////////////////////////////////////////////////////////////////////////// | |
1033 void DtoEmptyAllLists() | |
1034 { | |
1035 for(;;) | |
1036 { | |
1037 Dsymbol* dsym; | |
1038 if (!gIR->resolveList.empty()) { | |
1039 dsym = gIR->resolveList.front(); | |
1040 gIR->resolveList.pop_front(); | |
1041 DtoResolveDsymbol(dsym); | |
1042 } | |
1043 else if (!gIR->declareList.empty()) { | |
1044 dsym = gIR->declareList.front(); | |
1045 gIR->declareList.pop_front(); | |
1046 DtoDeclareDsymbol(dsym); | |
1047 } | |
1048 else if (!gIR->constInitList.empty()) { | |
1049 dsym = gIR->constInitList.front(); | |
1050 gIR->constInitList.pop_front(); | |
1051 DtoConstInitDsymbol(dsym); | |
1052 } | |
1053 else if (!gIR->defineList.empty()) { | |
1054 dsym = gIR->defineList.front(); | |
1055 gIR->defineList.pop_front(); | |
1056 DtoDefineDsymbol(dsym); | |
1057 } | |
1058 else { | |
1059 break; | |
1060 } | |
1061 } | |
1062 } | |
1063 | |
1064 ////////////////////////////////////////////////////////////////////////////////////////// | |
1065 | |
1066 void DtoForceDeclareDsymbol(Dsymbol* dsym) | 982 void DtoForceDeclareDsymbol(Dsymbol* dsym) |
1067 { | 983 { |
1068 if (dsym->ir.declared) return; | 984 if (dsym->ir.declared) return; |
1069 Logger::println("DtoForceDeclareDsymbol(%s)", dsym->toPrettyChars()); | 985 Logger::println("DtoForceDeclareDsymbol(%s)", dsym->toPrettyChars()); |
1070 LOG_SCOPE; | 986 LOG_SCOPE; |
1071 DtoResolveDsymbol(dsym); | 987 DtoResolveDsymbol(dsym); |
1072 | |
1073 DtoEmptyResolveList(); | |
1074 | |
1075 DtoDeclareDsymbol(dsym); | 988 DtoDeclareDsymbol(dsym); |
1076 } | 989 } |
1077 | 990 |
1078 ////////////////////////////////////////////////////////////////////////////////////////// | 991 ////////////////////////////////////////////////////////////////////////////////////////// |
1079 | 992 |
1081 { | 994 { |
1082 if (dsym->ir.initialized) return; | 995 if (dsym->ir.initialized) return; |
1083 Logger::println("DtoForceConstInitDsymbol(%s)", dsym->toPrettyChars()); | 996 Logger::println("DtoForceConstInitDsymbol(%s)", dsym->toPrettyChars()); |
1084 LOG_SCOPE; | 997 LOG_SCOPE; |
1085 DtoResolveDsymbol(dsym); | 998 DtoResolveDsymbol(dsym); |
1086 | 999 DtoDeclareDsymbol(dsym); |
1087 DtoEmptyResolveList(); | |
1088 DtoEmptyDeclareList(); | |
1089 | |
1090 DtoConstInitDsymbol(dsym); | 1000 DtoConstInitDsymbol(dsym); |
1091 } | 1001 } |
1092 | 1002 |
1093 ////////////////////////////////////////////////////////////////////////////////////////// | 1003 ////////////////////////////////////////////////////////////////////////////////////////// |
1094 | 1004 |
1096 { | 1006 { |
1097 if (dsym->ir.defined) return; | 1007 if (dsym->ir.defined) return; |
1098 Logger::println("DtoForceDefineDsymbol(%s)", dsym->toPrettyChars()); | 1008 Logger::println("DtoForceDefineDsymbol(%s)", dsym->toPrettyChars()); |
1099 LOG_SCOPE; | 1009 LOG_SCOPE; |
1100 DtoResolveDsymbol(dsym); | 1010 DtoResolveDsymbol(dsym); |
1101 | 1011 DtoDeclareDsymbol(dsym); |
1102 DtoEmptyResolveList(); | 1012 DtoConstInitDsymbol(dsym); |
1103 DtoEmptyDeclareList(); | |
1104 DtoEmptyConstInitList(); | |
1105 | |
1106 DtoDefineDsymbol(dsym); | 1013 DtoDefineDsymbol(dsym); |
1107 } | 1014 } |
1108 | 1015 |
1109 /****************************************************************************************/ | 1016 /****************************************************************************************/ |
1110 /*//////////////////////////////////////////////////////////////////////////////////////// | 1017 /*//////////////////////////////////////////////////////////////////////////////////////// |
1127 return DtoDeclarationExp(vd->aliassym); | 1034 return DtoDeclarationExp(vd->aliassym); |
1128 | 1035 |
1129 // static | 1036 // static |
1130 if (vd->isDataseg()) | 1037 if (vd->isDataseg()) |
1131 { | 1038 { |
1132 vd->toObjFile(0); // TODO: multiobj | 1039 vd->codegen(Type::sir); |
1133 } | 1040 } |
1134 else | 1041 else |
1135 { | 1042 { |
1136 if (global.params.llvmAnnotate) | 1043 if (global.params.llvmAnnotate) |
1137 DtoAnnotation(declaration->toChars()); | 1044 DtoAnnotation(declaration->toChars()); |