comparison dmd/attrib.c @ 1152:521dd1626d76

Added initial support for raw LLVM inline asm.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Sat, 28 Mar 2009 06:32:06 +0100
parents dbe4af57b240
children 4454126b4345
comparison
equal deleted inserted replaced
1151:3cf0066e6faf 1152:521dd1626d76
983 else 983 else
984 { 984 {
985 error("command '%s' invalid"); 985 error("command '%s' invalid");
986 fatal(); 986 fatal();
987 } 987 }
988 }
989
990 // pragma(llvm_inline_asm) { templdecl(s) }
991 else if (ident == Id::llvm_inline_asm)
992 {
993 if (args && args->dim > 0)
994 {
995 error("takes no parameters");
996 fatal();
997 }
998 llvm_internal = LLVMinline_asm;
988 } 999 }
989 1000
990 #endif // LDC 1001 #endif // LDC
991 1002
992 else if (ignoreUnsupportedPragmas) 1003 else if (ignoreUnsupportedPragmas)
1114 error("the '%s' pragma must only be used on function declarations of type 'void* function(uint nbytes)'", ident->toChars()); 1125 error("the '%s' pragma must only be used on function declarations of type 'void* function(uint nbytes)'", ident->toChars());
1115 fatal(); 1126 fatal();
1116 } 1127 }
1117 break; 1128 break;
1118 1129
1130 case LLVMinline_asm:
1131 if (TemplateDeclaration* td = s->isTemplateDeclaration())
1132 {
1133 if (td->parameters->dim != 0)
1134 {
1135 error("the '%s' pragma template must have exactly zero template parameters", ident->toChars());
1136 fatal();
1137 }
1138 else if (!td->onemember)
1139 {
1140 error("the '%s' pragma template must have exactly one member", ident->toChars());
1141 fatal();
1142 }
1143 else if (td->overnext || td->overroot)
1144 {
1145 error("the '%s' pragma template must not be overloaded", ident->toChars());
1146 fatal();
1147 }
1148 td->llvmInternal = llvm_internal;
1149 }
1150 else
1151 {
1152 error("the '%s' pragma is only allowed on template declarations", ident->toChars());
1153 fatal();
1154 }
1155 break;
1156
1119 default: 1157 default:
1120 warning("the LDC specific pragma '%s' is not yet implemented, ignoring", ident->toChars()); 1158 warning("the LDC specific pragma '%s' is not yet implemented, ignoring", ident->toChars());
1121 } 1159 }
1122 } 1160 }
1123 1161