llvm-dcpu16

LLVM backend for dcpu-16 processor

  • 所有者: llvm-dcpu16/llvm-dcpu16
  • 平台:
  • 許可證: Other
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

LLVM backend for DCPU-16

DCPU-16 is the processor from Mojang's new game 0x10c.
This project has a goal to make a full-featured LLVM backend for DCPU-16 and
port Clang to support this architecture.

Currently llvm backend and Clang support are nearly fully implemented.

Simple C SDK

You can download a simple C SDK, which includes clang with the binutils port for dcpu16.
It is Makefile based and contains a very simple C test program to demonstrate how you can develop your own program.

####Download####
You can find different precompiled packages for linux here.

There is also a very simple build script, which will assemble all needed parts for building the SDK yourself.

Please, let us know, if it does not work for you.

Building

First, of all, you need to install prerequisites:

sudo apt-get install gcc g++ git subversion git-svn make\
 perl gawk expect tcl texinfo bison autoconf automake cmake

Note, that when your python executable points to python3 (you can check that by running python --version)
you have to replace "cmake .." with "cmake -DPYTHON_EXECUTABLE=/path/to/python2 .." in the following steps (path is /usr/bin/python2 in most cases)

Next, get the sources and build it:

git clone git://github.com/llvm-dcpu16/llvm-dcpu16.git # Checkout LLVM
cd llvm-dcpu16/tools
git clone git://github.com/llvm-dcpu16/clang.git # Checkout Clang
mkdir ../cbuild
cd ../cbuild
cmake ..
make -j4

Using LLVM-DCPU16

Consider the following C file:

fib.c:

int fib(int n) {
  int cur = 1;
  int prev = 1;
  for (int i = 0; i < n; i++) {
    int next = cur+prev;
    prev = cur;
    cur = next;
  }
  return cur;
}

int main(void) {
  return fib(5);
}

Now, let's translate C to DCPU16 assembly:

bin/clang -ccc-host-triple dcpu16 -S fib.c -o fib.s

We generate DCPU16 v1.7 ASM with GAS compatible syntax. Most online
assemblers won't work. Please use the binutils port for DCPU16 to assemble and
link your program and then use an DCPU16 v1.7 compatible emulator to test your
program.

Enjoy and, please, report bugs!

主要指標

概覽
名稱與所有者llvm-dcpu16/llvm-dcpu16
主編程語言C++
編程語言Vim script (語言數: 10)
平台
許可證Other
所有者活动
創建於2012-04-05 07:50:01
推送於2016-07-02 21:32:08
最后一次提交2012-07-04 19:52:05
發布數0
用户参与
星數212
關注者數14
派生數20
提交數83.9k
已啟用問題?
問題數119
打開的問題數19
拉請求數70
打開的拉請求數1
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?