]>
Commit | Line | Data |
---|---|---|
b4c522fa IB |
1 | |
2 | /* Compiler implementation of the D programming language | |
8e788ac6 | 3 | * Copyright (C) 2018-2020 by The D Language Foundation, All Rights Reserved |
b4c522fa IB |
4 | * written by Walter Bright |
5 | * http://www.digitalmars.com | |
6 | * Distributed under the Boost Software License, Version 1.0. | |
7 | * http://www.boost.org/LICENSE_1_0.txt | |
8 | * https://github.com/D-Programming-Language/dmd/blob/master/src/iasm.c | |
9 | */ | |
10 | ||
11 | /* Inline assembler for the D programming language compiler | |
12 | */ | |
13 | ||
14 | #include "scope.h" | |
15 | #include "declaration.h" | |
16 | #include "statement.h" | |
17 | ||
18 | #ifdef IN_GCC | |
19 | Statement *gccAsmSemantic(GccAsmStatement *s, Scope *sc); | |
20 | #else | |
21 | Statement *inlineAsmSemantic(InlineAsmStatement *s, Scope *sc); | |
22 | #endif | |
23 | ||
24 | Statement *asmSemantic(AsmStatement *s, Scope *sc) | |
25 | { | |
26 | //printf("AsmStatement::semantic()\n"); | |
27 | ||
28 | FuncDeclaration *fd = sc->parent->isFuncDeclaration(); | |
29 | assert(fd); | |
30 | ||
31 | if (!s->tokens) | |
32 | return NULL; | |
33 | ||
34 | // Assume assembler code takes care of setting the return value | |
35 | sc->func->hasReturnExp |= 8; | |
36 | ||
37 | #ifdef IN_GCC | |
38 | GccAsmStatement *eas = new GccAsmStatement(s->loc, s->tokens); | |
39 | return gccAsmSemantic(eas, sc); | |
40 | #else | |
41 | InlineAsmStatement *ias = new InlineAsmStatement(s->loc, s->tokens); | |
42 | return inlineAsmSemantic(ias, sc); | |
43 | #endif | |
44 | } |