..... | ..... |
..... | ..... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
module TwoDArray where | |
import Data.Int | |
import Data.Word | |
import LLVM.Core | |
import LLVM.Util.Loop | |
import Data.TypeLevel (D2,D4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(ammunition_factory). | |
-export([repeat_explosion/2,time_bomb/1]). | |
time_bomb(0) -> exit("boom!"); | |
time_bomb(N) -> | |
timer:sleep(1000), | |
time_bomb(N-1). | |
repeat_explosion(0,N) -> | |
_Pid = spawn_monitor(fun() -> time_bomb(N) end), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### FIRST RUN | |
cci: only keeping CTP list: (null) | |
cci: In sock post_load | |
cci: In tcp post_load | |
cci: entering ctp_sock_init | |
cci: querying interface en0 info with socket ioctls and ethtool... | |
cci: adding device [en0] (transport sock) | |
cci: exiting ctp_sock_init | |
cci: entering ctp_tcp_init | |
cci: querying interface en0 info with socket ioctls and ethtool... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- API Module: Transport API as typeclass | |
class Transport t where | |
createTransport :: IO (Either IOException t) | |
newEndPoint :: t -> IO (Either (TransportError NewEndPointErrorCode) EndPoint) | |
closeTransport :: t -> IO () | |
-- Separate module: TCP implementation | |
newtype TCPTransport = TCPTransport (N.HostName,N.ServiceName,MVar TransportState,TCPParameters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
import Control.Concurrent.MVar | |
class Foo a where | |
mkFoo :: IO a | |
readFoo :: a -> IO Int | |
operateOnFoo :: a -> IO () | |
newtype Bar = Bar (MVar Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////// | |
// Before | |
syntax check | |
the model contains 7 never claims: never_6, never_5, never_4, never_3, never_2, never_1, never_0 | |
spin -a -o3 model.pml | |
the model contains 7 never claims: never_6, never_5, never_4, never_3, never_2, never_1, never_0 | |
only one claim is used in a verification run | |
choose which one with ./pan -N name (defaults to -N never_0) | |
gcc -DMEMLIM=1024 -O2 -DXUSAFE -DNOREDUCE -w -o pan pan.c | |
./pan -m10000 -a -c1 -N never_6 |