Giter Site home page Giter Site logo

Comments (9)

stopiccot avatar stopiccot commented on July 3, 2024

Just curious is it a clang problem or a crossbridge problem? Because as far as I know clang compiles FreeBSD 9 which sources are used in avm2_env

from crossbridge.

cbakgly avatar cbakgly commented on July 3, 2024

Really? Most of files under avm2_evn look unchanged comparing to master. Have you compared them to the freebsd version 9?

As an frontend, clang is different. It means you can not just switch to clang to make crossbridge work exactly as before unless you implement must-have parts. va_args is one of parts waiting to be added in.
I am going to add it after I get a clear picture of it. Also welcome anyone to make it come true. :)

from crossbridge.

stopiccot avatar stopiccot commented on July 3, 2024

I've found interesting statement in emscripten FAQ. They say that problem is caused by LE32 clang frontend and everything is OK with X86 frontend. Is crossbridge forced to use LE32 frontend?

from crossbridge.

stopiccot avatar stopiccot commented on July 3, 2024

I had investigated a bit further. And here are my thoughts what is the source of problem.
Error statement is: "cannot compile this aggregate va_arg expression yet"
After searching a bit I found that this error is raised in method AggExprEmitter::VisitVAArgExpr() (llvm-3.2/tools/clang/lib/GodeGen/CGExprAgg.cpp) As we see error occurs when method CGM.getTypes().getABIInfo().EmitVAArg() in method CodeGenFunction::EmitVAArg() (llvm-3.2/tools/clang/lib/CodeGen/CGCall.cpp) returns 0. ABI is initialized in method CodeGenModule::getTargetCodeGenInfo() (llvm-3.2/tools/clang/lib/GodeGen/TargetInfo.cpp)
For unknown for clang custom "avm2" architecture clang intializes DefaultTargetCodeGenInfo that stores DefaultABIInfo inside. DefaultABIInfo::EmitVAArg() is not implemented and just returns 0. So it seems to be not a clang problem. At least not a problem that should be fixed by clang team. We need to implement AVM2ABIInfo that implements EmitVAArg() method

from crossbridge.

cbakgly avatar cbakgly commented on July 3, 2024

Sorry for the misleading title. :'(
What I was trying to say was this part had not been added to clang yet. I never indicated it's a clang issue.

from crossbridge.

stopiccot avatar stopiccot commented on July 3, 2024

Oh, now I get it. But how it worked for gcc? Can we just use X86ABI? Initiallly I thought that flascc just takes LLVM created for generic X86 target and than converts it to AVM2 assembler, but now I'm not so sure. Also as far as I understand EmitVAArg just fetches value from valist according to abi convention. But where values are stored to valist according to that convention?

from crossbridge.

cbakgly avatar cbakgly commented on July 3, 2024

OK, I see you just copied a few lines as what I did. Though they are different under hood, but I guess X86ABI may work for this case, would you like to commit a more complete version by borrowing some code of X86_32?

from crossbridge.

stopiccot avatar stopiccot commented on July 3, 2024

Yep, I just looked through different implementations of EmitVAArgs for different platforms and extracted lines that seem to be common for all implementations. Yes, suggested implementation lacks alignment support. But I simply don't know how it should be done for avm2 or will X86_32 code work for avm2. So this implementation is just a first iteration that will allow code to compile, and probably to work.

from crossbridge.

cbakgly avatar cbakgly commented on July 3, 2024

Ok, just let it fly over the compilation and be fixed in future.

from crossbridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.