Skip to content

Instantly share code, notes, and snippets.

View robstewart57's full-sized avatar

Rob Stewart robstewart57

View GitHub Profile
@robstewart57
robstewart57 / hello-world-llvm.hs
Created October 28, 2013 09:51
generating hello world LLVM function from Haskell
import Control.Monad
import Data.Word
import LLVM.Core
import LLVM.Util.File
-- prints out "hello world"
bldGreet :: CodeGenModule (Function (IO ()))
bldGreet = do
puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr Word8 -> IO Word32)
func <- withStringNul "Hello, World!" $ \greetz ->
@robstewart57
robstewart57 / NotFirstClass.hs
Last active December 27, 2015 10:09
Using values that are not first class in LLVM
module Main where
import Data.Int
import LLVM.Core
import LLVM.ExecutionEngine
notFirstClass :: CodeGenModule (Function ([Int8] -> IO [Int8]))
notFirstClass = do
test <- createNamedFunction ExternalLinkage "test" $ \x -> do
{-# LANGUAGE ScopedTypeVariables #-}
module TwoDArray where
import Data.Int
import Data.Word
import LLVM.Core
import LLVM.Util.Loop
import Data.TypeLevel (D2,D4)
@robstewart57
robstewart57 / clang-cross-compiler-error-arm7a
Created November 27, 2013 13:52
Clang unable to cross-compile from x86_64 to ARM, Cortex a9
$ clang -v -target arm-none-eabi -mcpu=cortex-a9 -mfloat-abi=soft helloworld.c
clang version 3.3 (tags/RELEASE_33/rc3)
Target: arm-none--eabi
Thread model: posix
"/usr/bin/clang" -cc1 -triple armv7-none--eabi -S -disable-free -disable-llvm-verifier -main-file-name helloworld.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-abi aapcs -target-cpu cortex-a9 -msoft-float -mfloat-abi soft -target-feature +soft-float -target-feature +soft-float-abi -target-feature -neon -target-linker-version 2.23.52.0.1 -v -resource-dir /usr/bin/../lib/clang/3.3 -fno-dwarf-directory-asm -fdebug-compilation-dir /home/rob/code/c/llvm -ferror-limit 19 -fmessage-length 157 -mstackrealign -fno-signed-char -fobjc-runtime=gcc -fobjc-default-synthesize-properties -fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops -o /tmp/helloworld-Iarp5R.s -x c helloworld.c
clang -cc1 version 3.3 based upon LLVM 3.3 default target x86_64-redhat-linux-gnu
#include "..." search starts he
@robstewart57
robstewart57 / list-load-path-shadows
Created November 28, 2013 11:34
path shadows in my emacs
~/sw/erc/erc hides ~/.emacs.d/erc
/home/rob/.emacs.d/elpa/auctex-11.87/tex hides ~/.emacs.d/tex
/home/rob/.emacs.d/elpa/auctex-11.87/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info
/home/rob/.emacs.d/elpa/auctex-11.87/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp
/home/rob/.emacs.d/elpa/auctex-11.87/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl
/home/rob/.emacs.d/elpa/auctex-11.87/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex
/home/rob/.emacs.d/elpa/auctex-11.87/context-en hides /usr/share/emacs/site-lisp/auctex/context-en
/home/rob/.emacs.d/elpa/auctex-11.87/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf
/home/rob/.emacs.d/elpa/auctex-11.87/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x
/home/rob/.emacs.d/elpa/auctex-11.87/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt
#include <stdio.h>
int main(){
int i, j, k;
do {
if (i == 6){
k=0;
}
else{
i++;
@robstewart57
robstewart57 / mbsync-out
Created January 2, 2014 18:54
Output from running --pull-new with mbsync
This file has been truncated, but you can view the full file.
* OK [CAPABILITY IMAP4REV1 AUTH=LOGIN IDLE MOVE] IMAP4rev1 DavMail 4.4.0-2198 server ready
IMAP warning: SSL support not available
gpg: original file name='.mbsyncpass'
gpg: WARNING: message was not integrity protected
*** IMAP Warning *** Password is being sent in the clear
>>> 1 LOGIN <user> <pass>
1 OK Authenticated
>>> 2 LIST "" "*"
* LIST (\HasChildren) "/" "Archives"
* LIST (\HasNoChildren) "/" "Archives/2011"
@robstewart57
robstewart57 / orcc-xdf-error.log
Created January 7, 2014 18:15
eclipe XDF error log with ORCC plugin
!SESSION 2014-01-07 17:01:00.928 -----------------------------------------------
eclipse.buildId=M20120914-1800
java.version=1.7.0_45
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.equinox.p2.operations 4 0 2014-01-07 17:02:21.640
!MESSAGE Operation details
!SUBENTRY 1 org.eclipse.equinox.p2.director 4 1 2014-01-07 17:02:21.640
@robstewart57
robstewart57 / erl_crash.dump
Created January 26, 2014 17:37
erl_crash.dump when running eXAT demo
=erl_crash_dump:0.2
Sun Jan 26 17:33:30 2014
Slogan: init terminating in do_boot ()
System version: Erlang R16B02 (erts-5.10.3) [source] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Compiled: Mon Nov 25 18:08:35 2013
Taints:
Atoms: 7393
=memory
total: 7983848
processes: 3104436
@robstewart57
robstewart57 / atomic-primop-error
Created February 6, 2014 22:09
compilation error of atomic-primops with ghc 7.8
[rob@serena atomic-primops]$ which ghc
~/sw/ghc/ghc-7.8.20140130-BUILD/bin/ghc
[rob@serena atomic-primops]$
[rob@serena atomic-primops]$ cabal install primitive --reinstall
Resolving dependencies...
In order, the following will be installed:
primitive-0.5.1.0 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring primitive-0.5.1.0...
Building primitive-0.5.1.0...