Skip to content

Instantly share code, notes, and snippets.

@beholdnec
beholdnec / test2 out.txt
Created September 30, 2021 01:51
Output of compiling test2.cpp with Clang on ldstk-clobber-y branch
Args: clang (LLVM option parsing) -force-precise-rotation-cost -jump-inst-cost=6 -phi-node-folding-threshold=0 -two-entry-phi-node-folding-threshold=0 -align-large-globals=false -disable-spill-hoist -debug
Args: clang
Features:
CPU:mos6502
TuneCPU:mos6502
Features:
CPU:mos6502
@beholdnec
beholdnec / test2.cpp
Created September 17, 2021 23:50
test2.cpp for llvm-mos issue
#include <stdint.h>
class Base {
public:
virtual ~Base() { }
virtual void fn() = 0;
};
class SubA : public Base {
public:
@beholdnec
beholdnec / linkfile
Created May 18, 2019 21:04
wla-dx COMPUTE_PENDING_CALCULATIONS error
[objects]
test.o
@beholdnec
beholdnec / example1.ll
Created September 15, 2018 02:30
Simple NES example code compiled from C to LLVM IR (1)
; ModuleID = 'example1.c'
source_filename = "example1.c"
target datalayout = "e-p:16:8-n8"
target triple = "m6502"
@.str = private unnamed_addr constant [14 x i8] c"HELLO, WORLD!\00", align 1
@.str.1 = private unnamed_addr constant [27 x i8] c"THIS CODE PRINTS SOME TEXT\00", align 1
@.str.2 = private unnamed_addr constant [28 x i8] c"USING ASCII-ENCODED CHARSET\00", align 1
@.str.3 = private unnamed_addr constant [28 x i8] c"(WITH CAPITAL LETTERS ONLY)\00", align 1
@.str.4 = private unnamed_addr constant [28 x i8] c"TO USE CHR MORE EFFICIENTLY\00", align 1
@beholdnec
beholdnec / SPACY4.ll
Created May 21, 2018 07:13
Test file for llvm-m6502; originates from a small game
; ModuleID = 'SPACY4.c'
source_filename = "SPACY4.c"
target datalayout = "e-p:16:8-n8"
target triple = "m6502"
%struct.ENEMY = type { i8, i8, i8, i8, i8, i8, i8, i8 }
%struct.BULLET = type { i8, i8, i8, i8, i8, i8, i8, i8 }
@Title = constant [209 x i8] c"\01\00\01\C7\90\91\92\93\94\95\96\97\98\99\9A\9B\9C\9D\9E\9F\9F\00\01\0E\A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\AF\00\01\0E\B0\B1\B2\B3\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF\BF\00\01\0E\C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF\00\01\0F\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF\00\01\0F\E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB\EC\ED\EE\EF\00\01\0F\F0\F1\F2\F3\F4\F5\F6\F7\00\F9\FA\FB\FC\FD\FE\FF\00\01\91Press\00\00Start\00\01\912015\00Doug\00Fraker\00\01N Updated\00Aug\002016\00\01\A9\08\0A\0A\02\00\01\0B\05\01\03\00\01\09\01\00", align 1
@Stars = constant [160 x i8] c"\01\00\01\11\07\00\01\09\04\00\01\04\06\00\01*\04\00\01\05\06\00\01$\05\06\00\01#\04\00\06\00\07\00\01)\06\00\01\06\08\00\01\11\05\00\01'\04\00\01%\05\00\01\0E\06\00\01\11\06\00\
@beholdnec
beholdnec / vulkan-test.cpp
Created August 4, 2016 19:16
Vulkan API test; exhibits glitches
// Vulkan Test
// N.E.C.
#include <cstdio>
#include <condition_variable>
#include <thread>
#include <vector>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
; Generates ADD #123
define i8 @add(i8 %x) {
entry:
%result = add i8 %x, 123
ret i8 %result
}
; Generates ADD 123
@beholdnec
beholdnec / m6502-test-1.ll
Created February 12, 2016 08:51
Test file for llvm-m6502
; Generates ADD #123
define i8 @testAdd(i8 %x) {
entry:
%result = add i8 %x, 123
ret i8 %result
}
; Generates ADD 123