GithubHelp home page GithubHelp logo

beaker-cc's People

Contributors

asutton avatar cjb129 avatar darkarc avatar jenny-fa avatar jpetric837 avatar owenstranathan avatar th58 avatar toneill818 avatar tyharbert avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

beaker-cc's Issues

Does not compile on Cygwin

Recent changes that introduced the use of the C++ standard library function std::to_string() cause compiler errors when building Beaker with GCC on platforms where the system C library is newlib (e.g. Cygwin). This is a documented defect of libstdc++ (see asutton/origin#2) that has only been fixed recently in GCC 6.0, which is still under development.

Possible solutions include the workaround that is currently used in Origin, using std::ostringstream, or C++ Format.

Segfault generating recursive types

The program below segfaults (stack overflow) when generating the LLVM type.

struct S { s : S&; }

The generator needs to track which types have been defined instead of blindly recursing.

Incorrect code generation for '&&' and '||' operators

@asutton @thehexia: The current implementation of the code generation routines for the && and || operators in beaker/generator.cpp use the llvm::IRBuilder::CreateAnd() and llvm::IRBuilder::CreateOr() member functions, which produce instructions for the bitwise AND and OR operations, respectively—not the logical AND and OR (as I assume was the intention).

From llvm/IR/IRBuilder.h:

  Value *CreateAnd(Value *LHS, Value *RHS, const Twine &Name = "") {
    if (Constant *RC = dyn_cast<Constant>(RHS)) {
      if (isa<ConstantInt>(RC) && cast<ConstantInt>(RC)->isAllOnesValue())
        return LHS;  // LHS & -1 -> LHS
      if (Constant *LC = dyn_cast<Constant>(LHS))
        return Insert(Folder.CreateAnd(LC, RC), Name);
    }
    return Insert(BinaryOperator::CreateAnd(LHS, RHS), Name);
  }

  Value *CreateOr(Value *LHS, Value *RHS, const Twine &Name = "") {
    if (Constant *RC = dyn_cast<Constant>(RHS)) {
      if (RC->isNullValue())
        return LHS;  // LHS | 0 -> LHS
      if (Constant *LC = dyn_cast<Constant>(LHS))
        return Insert(Folder.CreateOr(LC, RC), Name);
    }
    return Insert(BinaryOperator::CreateOr(LHS, RHS), Name);
  }

FYI, I verified this myself using a test program—llvm::IRBuilder::CreateAnd() and llvm::IRBuilder::CreateOr() produce the 'and' and 'or' instructions, respectively.

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.