Code Monkey home page Code Monkey logo

llvm-z80's People

Contributors

jacobly0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

paintx adriweb

llvm-z80's Issues

Crash with -O1 and above on llvm::InstrEmitter::EmitRegSequence (InstrEmitter.cpp)

Crash with -O1 and above with this code:

#include <stdint.h>

extern char* foo(void**);
void test(uint16_t num)
{
    uint16_t bar = (num <= 0xFF) ? num : num+1;
    void* ptr = &bar;
    foo(&ptr);
}

Note 1: it crashes only with the value 0xFF in the num <= 0xFF comparison. Any other number, lower or higher, works fine.
Note 2: it doesn't crash at all if num is a uint24_t.

Assertion failed:

../../lib/CodeGen/SelectionDAG/InstrEmitter.cpp:642: void llvm::InstrEmitter::EmitRegSequence(llvm::SDNode*, llvm::DenseMap<llvm::SDValue, unsigned int>&, bool, bool):
Assertion `(NumOps & 1) == 1 && "REG_SEQUENCE must have an odd number of operands!"' failed.

Backtrace:

<libc things>
#8 0x00000381d963fdeb llvm::InstrEmitter::EmitRegSequence(llvm::SDNode*, llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>, llvm::detail::DenseMapPair<llvm::SDValue, unsigned int> >&, bool, bool) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0xbcdeb)
#9 0x00000381d9640ed0 llvm::InstrEmitter::EmitMachineNode(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, unsigned int, llvm::DenseMapInfo<llvm::SDValue>, llvm::detail::DenseMapPair<llvm::SDValue, unsigned int> >&) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0xbded0)
#10 0x00000381d96e8445 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x165445)
#11 0x00000381d976ec7b llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1ebc7b)
#12 0x00000381d976f503 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1ec503)
#13 0x00000381d9777dbe llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1f4dbe)
#14 0x00000381d9779d91 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone .part.986] (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1f6d91)
#15 0x00000381dea6c347 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/libLLVMCodeGen.so.5+0x1f1347)
#16 0x00000381de4772b3 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/libLLVMCore.so.5+0x16f2b3)
#17 0x00000381de47735c llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/libLLVMCore.so.5+0x16f35c)
#18 0x00000381de477b8a llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/libLLVMCore.so.5+0x16fb8a)
#19 0x00000381db2ff5ca (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/usr/lib/libclangCodeGen.so.5+0xbd5ca)
<...>

Steps:

0.	Program arguments: /opt/llvm/build/Debug/bin/clang-5.0 -cc1 -triple ez80 -S -disable-free -main-file-name test.c -mrelocation-model static -mthread-model posix -fmath-errno -no-integrated-as -mconstructor-aliases -target-cpu ez80 -momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /-.gcno -resource-dir /opt/llvm/build/Debug/lib/clang/5.0.0 -D interrupt=__attribute__((__interrupt__)) -D double=float -D reentrant= -I /opt/CEdev/include/ -I /opt/CEdev/include/compat -O3 -w -fno-dwarf-directory-asm -fdebug-compilation-dir / -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fno-common -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o - -x c <...>/test.c 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '<...>/test.c'.
4.	Running pass 'Z80 DAG->DAG Instruction Selection' on function '@test'

Crash with -O1 and above on llvm::MachineRegisterInfo::createVirtualRegister (MachineRegisterInfo.cpp)

Crash with -O1 and above with this code:

#include <stdbool.h>

bool test(bool foo)
{
    volatile bool bar = foo || false;
    return foo || bar;
}

Assertion failed:

clang-5.0: ../../lib/CodeGen/MachineRegisterInfo.cpp:124: unsigned int llvm::MachineRegisterInfo::createVirtualRegister(const llvm::TargetRegisterClass*)
Assertion `RegClass->isAllocatable() && "Virtual register RegClass must be allocatable."' failed.

Backtrace:

<libc things>
#9 0x000003c0441cd377 llvm::ScheduleDAGSDNodes::EmitPhysRegCopy(llvm::SUnit*, llvm::DenseMap<llvm::SUnit*, unsigned int, llvm::DenseMapInfo<llvm::SUnit*>, llvm::detail::DenseMapPair<llvm::SUnit*, unsigned int> >&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x161377)
#10 0x000003c0441d1462 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x165462)
#11 0x000003c044257c7b llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1ebc7b)
#12 0x000003c044258503 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1ec503)
#13 0x000003c044260dbe llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1f4dbe)
#14 0x000003c044262d91 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone .part.986] (/usr/lib/../lib/libLLVMSelectionDAG.so.5+0x1f6d91)
#15 0x000003c049555347 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/libLLVMCodeGen.so.5+0x1f1347)
#16 0x000003c048f602b3 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/libLLVMCore.so.5+0x16f2b3)
#17 0x000003c048f6035c llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/libLLVMCore.so.5+0x16f35c)
#18 0x000003c048f60b8a llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/libLLVMCore.so.5+0x16fb8a)
#19 0x000003c045de85ca (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/usr/lib/libclangCodeGen.so.5+0xbd5ca)
<...>

Steps:

0.	Program arguments: /opt/llvm/build/Debug/bin/clang-5.0 -cc1 -triple ez80 -S -disable-free -main-file-name test.c -mrelocation-model static -mthread-model posix -fmath-errno -no-integrated-as -mconstructor-aliases -target-cpu ez80 -momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /-.gcno -resource-dir /opt/llvm/build/Debug/lib/clang/5.0.0 -D interrupt=__attribute__((__interrupt__)) -D double=float -D reentrant= -I /opt/CEdev/include/ -I /opt/CEdev/include/compat -O3 -w -fno-dwarf-directory-asm -fdebug-compilation-dir / -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fno-common -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o - -x c <...>/test.c 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '<...>/test.c'.
4.	Running pass 'Z80 DAG->DAG Instruction Selection' on function '@test'

TODO list

Some bugs/things we saw over time:

  • Support of double type.
    Temporary (?) workaround: #define double float
  • Register allocation
    Some things still manage to break it. For instance, minilua ("fatal error: error in backend: ran out of registers during register allocation")
  • ...

Add support for fasmg in clang/lib/Driver/ToolChains

Right now, only the ZDS assembler is supported, but that's been made obsolete with fasmg, so it'd be nice to be able to use that.

Would also make things easier for TI-Planet's Project Builder when I decide to finally update the toolchain...

user guide?

Hello,

Any advice on how to use it?

Cheers,
Paul

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.