Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support for register type xxx __asm__(yyy) #33

Open
brmmm3 opened this issue Sep 16, 2017 · 4 comments
Open

Support for register type xxx __asm__(yyy) #33

brmmm3 opened this issue Sep 16, 2017 · 4 comments

Comments

@brmmm3
Copy link

brmmm3 commented Sep 16, 2017

Is it possible to add support for the following syntax:

register typeName variableName asm("registerName");

Best regards,
Martin

@inducer
Copy link
Owner

inducer commented Sep 16, 2017

Sure, I'd be happy to take a (tested) patch.

@inducer
Copy link
Owner

inducer commented Sep 16, 2017

(That is to say, a patch that includes tests.)

@brmmm3
Copy link
Author

brmmm3 commented Sep 17, 2017

I would if I would have enough experience to implement this. My current result ist:

def p_asm_register_declarator(self, p):
    """ declaration : declaration_specifiers declarator __ASM__ LPAREN argument_expression_list RPAREN
    """
    storage = p[1]["storage"]
    if not storage or (storage[0] != "register"):
        raise NotImplementedError(
                "register expected here '%s'"
                % list(p))
    decl = c_ast.TypeDecl(
        declname=p[1],
        type=None,
        quals=None,
        coord=self._token_coord(p, 2))
    spec = p[1]
    ty = spec['type']
    c_ast.Decl(
        name=None,
        quals=spec['qual'],
        storage=spec['storage'],
        funcspec=spec['function'],
        type=ty[0],
        init=None,
        bitsize=None,
        coord=ty[0].coord)
    p[0] = self._type_modify_decl(decl, p[2])

But it seems to be wrong because when I convert it back to C-Code then no C-Code is created for this line.
I hoped that you as the maintainer have enough experience to quickly implement it.

Best regards,
Martin

@refi64
Copy link

refi64 commented Sep 18, 2017

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants