Mercurial > projects > ldc
comparison gen/asmstmt.cpp @ 237:a168a2c3ea48 trunk
[svn r253] Removed -inlineasm option. inline asm is now enabled by default unless the new -noasm option is passed.
Tried adding a stack trace print when compiler crashes, not sure it's working though.
Changed data layouts to match that of llvm-gcc.
Fixed casting function pointers.
Added support checks in AsmStatement.
author | lindquist |
---|---|
date | Sun, 08 Jun 2008 19:09:24 +0200 |
parents | 9760f54af0b7 |
children | fa691b1c0498 |
comparison
equal
deleted
inserted
replaced
236:df1abfe27be6 | 237:a168a2c3ea48 |
---|---|
196 | 196 |
197 bool d_have_inline_asm() { return true; } | 197 bool d_have_inline_asm() { return true; } |
198 | 198 |
199 Statement *AsmStatement::semantic(Scope *sc) | 199 Statement *AsmStatement::semantic(Scope *sc) |
200 { | 200 { |
201 | 201 bool err = false; |
202 if (global.params.cpu != ARCHx86) | |
203 { | |
204 error("inline asm is not supported for the \"%s\" architecture", global.params.llvmArch); | |
205 err = true; | |
206 } | |
207 if (!global.params.useInlineAsm) | |
208 { | |
209 error("inline asm is not allowed when the -noasm switch is used"); | |
210 err = true; | |
211 } | |
212 if (err) | |
213 fatal(); | |
214 | |
202 sc->func->inlineAsm = 1; | 215 sc->func->inlineAsm = 1; |
203 sc->func->inlineStatus = ILSno; // %% not sure | 216 sc->func->inlineStatus = ILSno; // %% not sure |
204 // %% need to set DECL_UNINLINABLE too? | 217 // %% need to set DECL_UNINLINABLE too? |
205 sc->func->hasReturnExp = 1; // %% DMD does this, apparently... | 218 sc->func->hasReturnExp = 1; // %% DMD does this, apparently... |
206 | 219 |
259 AsmArg * arg = (AsmArg *) code->args.data[i]; | 272 AsmArg * arg = (AsmArg *) code->args.data[i]; |
260 | 273 |
261 bool is_input = true; | 274 bool is_input = true; |
262 LLValue* arg_val = 0; | 275 LLValue* arg_val = 0; |
263 std::string cns; | 276 std::string cns; |
264 | |
265 std::cout << std::endl; | |
266 | 277 |
267 switch (arg->type) { | 278 switch (arg->type) { |
268 case Arg_Integer: | 279 case Arg_Integer: |
269 arg_val = arg->expr->toElem(irs)->getRVal(); | 280 arg_val = arg->expr->toElem(irs)->getRVal(); |
270 do_integer: | 281 do_integer: |
377 } else if (*p == '$') | 388 } else if (*p == '$') |
378 pct = true; | 389 pct = true; |
379 ++p; | 390 ++p; |
380 } | 391 } |
381 | 392 |
382 printf("final: %.*s\n", code->insnTemplateLen, code->insnTemplate); | 393 Logger::println("final asm: %.*s", code->insnTemplateLen, code->insnTemplate); |
383 | 394 |
384 std::string insnt(code->insnTemplate, code->insnTemplateLen); | 395 std::string insnt(code->insnTemplate, code->insnTemplateLen); |
385 | 396 |
386 // rewrite GCC-style constraints to LLVM-style constraints | 397 // rewrite GCC-style constraints to LLVM-style constraints |
387 std::string llvmOutConstraints; | 398 std::string llvmOutConstraints; |