https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87291

--- Comment #29 from bouanto at zoho dot com ---
This API looks fine.

Another test would be to create a simple function, the equivalent of this:

#include <assert.h>

asm(
    "add:\n"
    "movq %rdi, %rax\n"
    "add %rsi, %rax\n"
    "ret\n");

extern int add(int, int);

int main(void) {
    assert(add(40, 2) == 42);
}

(In reply to David Malcolm from comment #27)
> Created attachment 48694 [details]
> v3 of the work-in-progress patch
> 
> Here's an updated version of the patch; also uploaded to:
> https://dmalcolm.fedorapeople.org/gcc/2020-06-06/0001-FIXME-WIP-on-extended-
> asm-support-v3.patch
> 
> In particular, this adds a new:
>   gcc_jit_context_add_top_level_asm
> entrypoint.  On implementing this, it hooks into the symbol table like the C
> frontend does, so it looks like it will respect ordering as much as the C
> frontend does.
> 
> How does this look?  The top-level asm code is barely tested though; I'd
> appreciate a way to verify it from the automated test case.
> 
> Changes in v3:
> * added gcc_jit_context_add_top_level_asm
> * drop redundant gcc_jit_extended_asm_add_goto_label
> * added gcc_jit_extended_asm_as_object
> * started adding documentation
> * added comments to libgccjit.h
> * consolidated test-asm.c, grouping create/verify pairs
> * add test coverage for "volatile"
> * initial implementation of make_debug_string
> * added some error-checking

Reply via email to