mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 14:48:40 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ecefd6a0a | |||
| ed2a98c7d0 | |||
| 731532cd2b | |||
| adadbadec3 | |||
| 58fafaeb5c | |||
| 13a8eae0d4 | |||
| 42da7654ec | |||
| 8698a7e496 | |||
| 1d7543e2bf | |||
| ff32fbbb4f | |||
| 3ad2530ee7 | |||
| c4de195f04 | |||
| 75aca0f5ee | |||
| bb9a9beed5 | |||
| 4042c1d618 | |||
| bf73516259 | |||
| 43d282174f | |||
| 0042bf62a5 | |||
| f11731ff35 | |||
| e9d8a9bc0b | |||
| 9d6eb1ff06 | |||
| 4643401a1d |
@@ -10,12 +10,12 @@ commands:
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- llvm-source-14-v3
|
||||
- llvm-source-16-v3
|
||||
- run:
|
||||
name: "Fetch LLVM source"
|
||||
command: make llvm-source
|
||||
- save_cache:
|
||||
key: llvm-source-14-v3
|
||||
key: llvm-source-16-v3
|
||||
paths:
|
||||
- llvm-project/clang/lib/Headers
|
||||
- llvm-project/clang/include
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-source
|
||||
with:
|
||||
key: llvm-source-15-macos-v3
|
||||
key: llvm-source-16-macos-v1
|
||||
path: |
|
||||
llvm-project/clang/lib/Headers
|
||||
llvm-project/clang/include
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-build
|
||||
with:
|
||||
key: llvm-build-15-macos-v4
|
||||
key: llvm-build-16-macos-v1
|
||||
path: llvm-build
|
||||
- name: Build LLVM
|
||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||
@@ -120,7 +120,7 @@ jobs:
|
||||
- name: Install LLVM
|
||||
shell: bash
|
||||
run: |
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@15
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@16
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Go
|
||||
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-contexts: tinygo-llvm-build=docker-image://tinygo/llvm-15
|
||||
build-contexts: tinygo-llvm-build=docker-image://tinygo/llvm-16
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
- name: Trigger Drivers repo build on Github Actions
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-source
|
||||
with:
|
||||
key: llvm-source-15-linux-alpine-v3
|
||||
key: llvm-source-16-linux-alpine-v1
|
||||
path: |
|
||||
llvm-project/clang/lib/Headers
|
||||
llvm-project/clang/include
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-build
|
||||
with:
|
||||
key: llvm-build-15-linux-alpine-v4
|
||||
key: llvm-build-16-linux-alpine-v1
|
||||
path: llvm-build
|
||||
- name: Build LLVM
|
||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||
@@ -194,7 +194,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-source
|
||||
with:
|
||||
key: llvm-source-15-linux-asserts-v3
|
||||
key: llvm-source-16-linux-asserts-v1
|
||||
path: |
|
||||
llvm-project/clang/lib/Headers
|
||||
llvm-project/clang/include
|
||||
@@ -219,7 +219,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-build
|
||||
with:
|
||||
key: llvm-build-15-linux-asserts-v4
|
||||
key: llvm-build-16-linux-asserts-v1
|
||||
path: llvm-build
|
||||
- name: Build LLVM
|
||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||
@@ -297,7 +297,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-source
|
||||
with:
|
||||
key: llvm-source-15-linux-v3
|
||||
key: llvm-source-16-linux-v1
|
||||
path: |
|
||||
llvm-project/clang/lib/Headers
|
||||
llvm-project/clang/include
|
||||
@@ -322,7 +322,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-build
|
||||
with:
|
||||
key: llvm-build-15-linux-arm-v4
|
||||
key: llvm-build-16-linux-arm-v1
|
||||
path: llvm-build
|
||||
- name: Build LLVM
|
||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||
@@ -414,7 +414,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-source
|
||||
with:
|
||||
key: llvm-source-15-linux-v3
|
||||
key: llvm-source-16-linux-v1
|
||||
path: |
|
||||
llvm-project/clang/lib/Headers
|
||||
llvm-project/clang/include
|
||||
@@ -439,7 +439,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-build
|
||||
with:
|
||||
key: llvm-build-15-linux-arm64-v4
|
||||
key: llvm-build-16-linux-arm64-v1
|
||||
path: llvm-build
|
||||
- name: Build LLVM
|
||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||
|
||||
@@ -35,8 +35,8 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
tinygo/llvm-15
|
||||
ghcr.io/${{ github.repository_owner }}/llvm-15
|
||||
tinygo/llvm-16
|
||||
ghcr.io/${{ github.repository_owner }}/llvm-16
|
||||
tags: |
|
||||
type=sha,format=long
|
||||
type=raw,value=latest
|
||||
|
||||
@@ -24,19 +24,19 @@ jobs:
|
||||
submodules: true
|
||||
- name: Install apt dependencies
|
||||
run: |
|
||||
echo 'deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main' | sudo tee /etc/apt/sources.list.d/llvm.list
|
||||
echo 'deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main' | sudo tee /etc/apt/sources.list.d/llvm.list
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y \
|
||||
llvm-15-dev \
|
||||
clang-15 \
|
||||
libclang-15-dev \
|
||||
lld-15
|
||||
llvm-16-dev \
|
||||
clang-16 \
|
||||
libclang-16-dev \
|
||||
lld-16
|
||||
- name: Restore LLVM source cache
|
||||
uses: actions/cache@v3
|
||||
id: cache-llvm-source
|
||||
with:
|
||||
key: llvm-source-15-sizediff-v1
|
||||
key: llvm-source-16-sizediff-v1
|
||||
path: |
|
||||
llvm-project/compiler-rt
|
||||
- name: Download LLVM source
|
||||
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-source
|
||||
with:
|
||||
key: llvm-source-15-windows-v4
|
||||
key: llvm-source-16-windows-v1
|
||||
path: |
|
||||
llvm-project/clang/lib/Headers
|
||||
llvm-project/clang/include
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache-llvm-build
|
||||
with:
|
||||
key: llvm-build-15-windows-v6
|
||||
key: llvm-build-16-windows-v2
|
||||
path: llvm-build
|
||||
- name: Build LLVM
|
||||
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
|
||||
|
||||
@@ -1,3 +1,25 @@
|
||||
0.30.0
|
||||
---
|
||||
|
||||
* **general**
|
||||
- add LLVM 16 support, use it by default
|
||||
* **compiler**
|
||||
- `build`: work around a race condition by building Go SSA serially
|
||||
- `compiler`: fix a crash by not using the LLVM global context types
|
||||
- `interp`: don't copy unknown values in `runtime.sliceCopy` to fix miscompile
|
||||
- `interp`: fix crash in error report by not returning raw LLVM values
|
||||
* **standard library**
|
||||
- `machine/usb/adc/midi`: various improvements and API changes
|
||||
- `reflect`: add support for `[...]T` → `[]T` in reflect
|
||||
* **targets**
|
||||
- `atsamd21`, `atsamd51`: add support for USB INTERRUPT OUT
|
||||
- `rp2040`: always use the USB device enumeration fix, even in chips that supposedly have the HW fix
|
||||
- `wasm`: increase default stack size to 32k for wasi/wasm
|
||||
* **boards**
|
||||
- `gobadge`: add GoBadge target as alias for PyBadge :)
|
||||
- `gemma-m0`: add support for the Adafruit Gemma M0
|
||||
|
||||
|
||||
0.29.0
|
||||
---
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ LLD_SRC ?= $(LLVM_PROJECTDIR)/lld
|
||||
|
||||
# Try to autodetect LLVM build tools.
|
||||
# Versions are listed here in descending priority order.
|
||||
LLVM_VERSIONS = 15 14 13 12 11
|
||||
LLVM_VERSIONS = 16 15 14 13 12 11
|
||||
errifempty = $(if $(1),$(1),$(error $(2)))
|
||||
detect = $(shell which $(call errifempty,$(firstword $(foreach p,$(2),$(shell command -v $(p) 2> /dev/null && echo $(p)))),failed to locate $(1) at any of: $(2)))
|
||||
toolSearchPathsVersion = $(1)-$(2)
|
||||
@@ -113,7 +113,7 @@ endif
|
||||
|
||||
.PHONY: all tinygo test $(LLVM_BUILDDIR) llvm-source clean fmt gen-device gen-device-nrf gen-device-nxp gen-device-avr gen-device-rp
|
||||
|
||||
LLVM_COMPONENTS = all-targets analysis asmparser asmprinter bitreader bitwriter codegen core coroutines coverage debuginfodwarf debuginfopdb executionengine frontendopenmp instrumentation interpreter ipo irreader libdriver linker lto mc mcjit objcarcopts option profiledata scalaropts support target windowsdriver windowsmanifest
|
||||
LLVM_COMPONENTS = all-targets analysis asmparser asmprinter bitreader bitwriter codegen core coroutines coverage debuginfodwarf debuginfopdb executionengine frontendhlsl frontendopenmp instrumentation interpreter ipo irreader libdriver linker lto mc mcjit objcarcopts option profiledata scalaropts support target windowsdriver windowsmanifest
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
EXE = .exe
|
||||
@@ -154,7 +154,7 @@ LLD_LIB_NAMES = lldCOFF lldCommon lldELF lldMachO lldMinGW lldWasm
|
||||
LLD_LIBS = $(START_GROUP) $(addprefix -l,$(LLD_LIB_NAMES)) $(END_GROUP)
|
||||
|
||||
# Other libraries that are needed to link TinyGo.
|
||||
EXTRA_LIB_NAMES = LLVMInterpreter LLVMMCA LLVMX86TargetMCA
|
||||
EXTRA_LIB_NAMES = LLVMInterpreter LLVMMCA LLVMRISCVTargetMCA LLVMX86TargetMCA
|
||||
|
||||
# All libraries to be built and linked with the tinygo binary (lib/lib*.a).
|
||||
LIB_NAMES = clang $(CLANG_LIB_NAMES) $(LLD_LIB_NAMES) $(EXTRA_LIB_NAMES)
|
||||
@@ -170,7 +170,7 @@ NINJA_BUILD_TARGETS = clang llvm-config llvm-ar llvm-nm $(addprefix lib/lib,$(ad
|
||||
# For static linking.
|
||||
ifneq ("$(wildcard $(LLVM_BUILDDIR)/bin/llvm-config*)","")
|
||||
CGO_CPPFLAGS+=$(shell $(LLVM_CONFIG_PREFIX) $(LLVM_BUILDDIR)/bin/llvm-config --cppflags) -I$(abspath $(LLVM_BUILDDIR))/tools/clang/include -I$(abspath $(CLANG_SRC))/include -I$(abspath $(LLD_SRC))/include
|
||||
CGO_CXXFLAGS=-std=c++14
|
||||
CGO_CXXFLAGS=-std=c++17
|
||||
CGO_LDFLAGS+=-L$(abspath $(LLVM_BUILDDIR)/lib) -lclang $(CLANG_LIBS) $(LLD_LIBS) $(shell $(LLVM_CONFIG_PREFIX) $(LLVM_BUILDDIR)/bin/llvm-config --ldflags --libs --system-libs $(LLVM_COMPONENTS)) -lstdc++ $(CGO_LDFLAGS_EXTRA)
|
||||
endif
|
||||
|
||||
@@ -238,7 +238,7 @@ gen-device-renesas: build/gen-device-svd
|
||||
|
||||
# Get LLVM sources.
|
||||
$(LLVM_PROJECTDIR)/llvm:
|
||||
git clone -b xtensa_release_15.x --depth=1 https://github.com/espressif/llvm-project $(LLVM_PROJECTDIR)
|
||||
git clone -b xtensa_release_16.x --depth=1 https://github.com/espressif/llvm-project $(LLVM_PROJECTDIR)
|
||||
llvm-source: $(LLVM_PROJECTDIR)/llvm
|
||||
|
||||
# Configure LLVM.
|
||||
@@ -558,6 +558,8 @@ endif
|
||||
@$(MD5SUM) test.hex
|
||||
$(TINYGO) build -size short -o test.hex -target=trinket-m0 examples/blinky1
|
||||
@$(MD5SUM) test.hex
|
||||
$(TINYGO) build -size short -o test.hex -target=gemma-m0 examples/blinky1
|
||||
@$(MD5SUM) test.hex
|
||||
$(TINYGO) build -size short -o test.hex -target=circuitplay-express examples/blinky1
|
||||
@$(MD5SUM) test.hex
|
||||
$(TINYGO) build -size short -o test.hex -target=circuitplay-bluefruit examples/blinky1
|
||||
|
||||
@@ -344,6 +344,10 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
||||
}
|
||||
packageActionIDJobs[pkg.ImportPath] = packageActionIDJob
|
||||
|
||||
// Build the SSA for the given package.
|
||||
ssaPkg := program.Package(pkg.Pkg)
|
||||
ssaPkg.Build()
|
||||
|
||||
// Now create the job to actually build the package. It will exit early
|
||||
// if the package is already compiled.
|
||||
job := &compileJob{
|
||||
|
||||
+19
-2
@@ -56,6 +56,7 @@
|
||||
#include "llvm/Support/Timer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <system_error>
|
||||
using namespace clang;
|
||||
using namespace clang::driver;
|
||||
@@ -103,6 +104,14 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
||||
Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
|
||||
if (Arg *A = Args.getLastArg(options::OPT_darwin_target_variant_triple))
|
||||
Opts.DarwinTargetVariantTriple = llvm::Triple(A->getValue());
|
||||
if (Arg *A = Args.getLastArg(OPT_darwin_target_variant_sdk_version_EQ)) {
|
||||
VersionTuple Version;
|
||||
if (Version.tryParse(A->getValue()))
|
||||
Diags.Report(diag::err_drv_invalid_value)
|
||||
<< A->getAsString(Args) << A->getValue();
|
||||
else
|
||||
Opts.DarwinTargetVariantSDKVersion = Version;
|
||||
}
|
||||
|
||||
Opts.CPU = std::string(Args.getLastArgValue(OPT_target_cpu));
|
||||
Opts.Features = Args.getAllArgValues(OPT_target_feature);
|
||||
@@ -122,11 +131,12 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
||||
Opts.CompressDebugSections =
|
||||
llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
|
||||
.Case("none", llvm::DebugCompressionType::None)
|
||||
.Case("zlib", llvm::DebugCompressionType::Z)
|
||||
.Case("zlib", llvm::DebugCompressionType::Zlib)
|
||||
.Case("zstd", llvm::DebugCompressionType::Zstd)
|
||||
.Default(llvm::DebugCompressionType::None);
|
||||
}
|
||||
|
||||
Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations);
|
||||
Opts.RelaxELFRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
|
||||
if (auto *DwarfFormatArg = Args.getLastArg(OPT_gdwarf64, OPT_gdwarf32))
|
||||
Opts.Dwarf64 = DwarfFormatArg->getOption().matches(OPT_gdwarf64);
|
||||
Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 2, Diags);
|
||||
@@ -189,6 +199,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
||||
Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
|
||||
Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings);
|
||||
Opts.NoWarn = Args.hasArg(OPT_massembler_no_warn);
|
||||
Opts.NoTypeCheck = Args.hasArg(OPT_mno_type_check);
|
||||
Opts.RelocationModel =
|
||||
std::string(Args.getLastArgValue(OPT_mrelocation_model, "pic"));
|
||||
Opts.TargetABI = std::string(Args.getLastArgValue(OPT_target_abi));
|
||||
@@ -214,6 +225,8 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
||||
.Case("default", EmitDwarfUnwindType::Default);
|
||||
}
|
||||
|
||||
Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -265,6 +278,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
||||
|
||||
MCTargetOptions MCOptions;
|
||||
MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
|
||||
MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
|
||||
|
||||
std::unique_ptr<MCAsmInfo> MAI(
|
||||
TheTarget->createMCAsmInfo(*MRI, Opts.Triple, MCOptions));
|
||||
@@ -314,6 +328,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
||||
TheTarget->createMCObjectFileInfo(Ctx, PIC));
|
||||
if (Opts.DarwinTargetVariantTriple)
|
||||
MOFI->setDarwinTargetVariantTriple(*Opts.DarwinTargetVariantTriple);
|
||||
if (!Opts.DarwinTargetVariantSDKVersion.empty())
|
||||
MOFI->setDarwinTargetVariantSDKVersion(Opts.DarwinTargetVariantSDKVersion);
|
||||
Ctx.setObjectFileInfo(MOFI.get());
|
||||
|
||||
if (Opts.SaveTemporaryLabels)
|
||||
@@ -353,6 +369,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
||||
|
||||
MCOptions.MCNoWarn = Opts.NoWarn;
|
||||
MCOptions.MCFatalWarnings = Opts.FatalWarnings;
|
||||
MCOptions.MCNoTypeCheck = Opts.NoTypeCheck;
|
||||
MCOptions.ABIName = Opts.TargetABI;
|
||||
|
||||
// FIXME: There is a bit of code duplication with addPassesToEmitFile.
|
||||
|
||||
+10
-1
@@ -82,6 +82,7 @@ struct AssemblerInvocation {
|
||||
unsigned NoExecStack : 1;
|
||||
unsigned FatalWarnings : 1;
|
||||
unsigned NoWarn : 1;
|
||||
unsigned NoTypeCheck : 1;
|
||||
unsigned IncrementalLinkerCompatible : 1;
|
||||
unsigned EmbedBitcode : 1;
|
||||
|
||||
@@ -97,7 +98,14 @@ struct AssemblerInvocation {
|
||||
|
||||
/// Darwin target variant triple, the variant of the deployment target
|
||||
/// for which the code is being compiled.
|
||||
llvm::Optional<llvm::Triple> DarwinTargetVariantTriple;
|
||||
std::optional<llvm::Triple> DarwinTargetVariantTriple;
|
||||
|
||||
/// The version of the darwin target variant SDK which was used during the
|
||||
/// compilation
|
||||
llvm::VersionTuple DarwinTargetVariantSDKVersion;
|
||||
|
||||
/// The name of a file to use with \c .secure_log_unique directives.
|
||||
std::string AsSecureLogFile;
|
||||
/// @}
|
||||
|
||||
public:
|
||||
@@ -114,6 +122,7 @@ public:
|
||||
NoExecStack = 0;
|
||||
FatalWarnings = 0;
|
||||
NoWarn = 0;
|
||||
NoTypeCheck = 0;
|
||||
IncrementalLinkerCompatible = 0;
|
||||
Dwarf64 = 0;
|
||||
DwarfVersion = 0;
|
||||
|
||||
@@ -41,9 +41,9 @@ func TestBinarySize(t *testing.T) {
|
||||
// This is a small number of very diverse targets that we want to test.
|
||||
tests := []sizeTest{
|
||||
// microcontrollers
|
||||
{"hifive1b", "examples/echo", 4612, 280, 0, 2252},
|
||||
{"microbit", "examples/serial", 2724, 388, 8, 2256},
|
||||
{"wioterminal", "examples/pininterrupt", 6039, 1485, 116, 6816},
|
||||
{"hifive1b", "examples/echo", 4568, 280, 0, 2252},
|
||||
{"microbit", "examples/serial", 2728, 388, 8, 2256},
|
||||
{"wioterminal", "examples/pininterrupt", 5996, 1484, 116, 6816},
|
||||
|
||||
// TODO: also check wasm. Right now this is difficult, because
|
||||
// wasm binaries are run through wasm-opt and therefore the
|
||||
|
||||
+9
-19
@@ -75,19 +75,10 @@ type bitfieldInfo struct {
|
||||
}
|
||||
|
||||
// cgoAliases list type aliases between Go and C, for types that are equivalent
|
||||
// in both languages. See addTypeAliases.
|
||||
// in both languages.
|
||||
var cgoAliases = map[string]string{
|
||||
"C.int8_t": "int8",
|
||||
"C.int16_t": "int16",
|
||||
"C.int32_t": "int32",
|
||||
"C.int64_t": "int64",
|
||||
"C.uint8_t": "uint8",
|
||||
"C.uint16_t": "uint16",
|
||||
"C.uint32_t": "uint32",
|
||||
"C.uint64_t": "uint64",
|
||||
"C.uintptr_t": "uintptr",
|
||||
"C.float": "float32",
|
||||
"C.double": "float64",
|
||||
"float": "float32",
|
||||
"double": "float64",
|
||||
}
|
||||
|
||||
// builtinAliases are handled specially because they only exist on the Go side
|
||||
@@ -311,10 +302,11 @@ func Process(files []*ast.File, dir, importPath string, fset *token.FileSet, cfl
|
||||
// Process CGo imports for each file.
|
||||
for i, f := range files {
|
||||
cf := p.newCGoFile(f, i)
|
||||
// Float and double are aliased, meaning that C.float is the same thing
|
||||
// as float32 in Go.
|
||||
cf.names["float"] = clangCursor{}
|
||||
cf.names["double"] = clangCursor{}
|
||||
// These types are aliased with the corresponding types in C. For
|
||||
// example, float in C is always float32 in Go.
|
||||
for name := range cgoAliases {
|
||||
cf.names[name] = clangCursor{}
|
||||
}
|
||||
// Now read all the names (identifies) that C defines in the header
|
||||
// snippet.
|
||||
cf.readNames(p.cgoHeaders[i], cflagsForCGo, filepath.Base(fset.File(f.Pos()).Name()), func(names map[string]clangCursor) {
|
||||
@@ -1129,9 +1121,7 @@ func (p *cgoPackage) getUnnamedDeclName(prefix string, itf interface{}) string {
|
||||
// getASTDeclName will declare the given C AST node (if not already defined) and
|
||||
// will return its name, in the form of C.foo.
|
||||
func (f *cgoFile) getASTDeclName(name string, found clangCursor, iscall bool) string {
|
||||
// Some types are defined in stdint.h and map directly to a particular Go
|
||||
// type.
|
||||
if alias := cgoAliases["C."+name]; alias != "" {
|
||||
if alias := cgoAliases[name]; alias != "" {
|
||||
return alias
|
||||
}
|
||||
node := f.getASTDeclNode(name, found, iscall)
|
||||
|
||||
+16
-2
@@ -60,6 +60,7 @@ CXSourceRange tinygo_clang_getCursorExtent(GoCXCursor c);
|
||||
CXTranslationUnit tinygo_clang_Cursor_getTranslationUnit(GoCXCursor c);
|
||||
long long tinygo_clang_getEnumConstantDeclValue(GoCXCursor c);
|
||||
CXType tinygo_clang_getEnumDeclIntegerType(GoCXCursor c);
|
||||
unsigned tinygo_clang_Cursor_isAnonymous(GoCXCursor c);
|
||||
unsigned tinygo_clang_Cursor_isBitField(GoCXCursor c);
|
||||
|
||||
int tinygo_clang_globals_visitor(GoCXCursor c, GoCXCursor parent, CXClientData client_data);
|
||||
@@ -653,8 +654,19 @@ func (p *cgoPackage) addErrorAt(position token.Position, msg string) {
|
||||
func (f *cgoFile) makeDecayingASTType(typ C.CXType, pos token.Pos) ast.Expr {
|
||||
// Strip typedefs, if any.
|
||||
underlyingType := typ
|
||||
if underlyingType.kind == C.CXType_Elaborated {
|
||||
// Starting with LLVM 16, the elaborated type is used for more types.
|
||||
// According to the Clang documentation, the elaborated type has no
|
||||
// semantic meaning so can be stripped (it is used to better convey type
|
||||
// name information).
|
||||
// Source:
|
||||
// https://clang.llvm.org/doxygen/classclang_1_1ElaboratedType.html#details
|
||||
// > The type itself is always "sugar", used to express what was written
|
||||
// > in the source code but containing no additional semantic information.
|
||||
underlyingType = C.clang_Type_getNamedType(underlyingType)
|
||||
}
|
||||
if underlyingType.kind == C.CXType_Typedef {
|
||||
c := C.tinygo_clang_getTypeDeclaration(typ)
|
||||
c := C.tinygo_clang_getTypeDeclaration(underlyingType)
|
||||
underlyingType = C.tinygo_clang_getTypedefDeclUnderlyingType(c)
|
||||
// TODO: support a chain of typedefs. At the moment, it seems to get
|
||||
// stuck in an endless loop when trying to get to the most underlying
|
||||
@@ -788,6 +800,8 @@ func (f *cgoFile) makeASTType(typ C.CXType, pos token.Pos) ast.Expr {
|
||||
return f.makeASTType(underlying, pos)
|
||||
case C.CXType_Enum:
|
||||
return f.makeASTType(underlying, pos)
|
||||
case C.CXType_Typedef:
|
||||
return f.makeASTType(underlying, pos)
|
||||
default:
|
||||
typeKindSpelling := getString(C.clang_getTypeKindSpelling(underlying.kind))
|
||||
f.addError(pos, fmt.Sprintf("unknown elaborated type (libclang type kind %s)", typeKindSpelling))
|
||||
@@ -806,7 +820,7 @@ func (f *cgoFile) makeASTType(typ C.CXType, pos token.Pos) ast.Expr {
|
||||
// makeASTRecordType will create an appropriate error.
|
||||
cgoRecordPrefix = "record_"
|
||||
}
|
||||
if name == "" {
|
||||
if name == "" || C.tinygo_clang_Cursor_isAnonymous(cursor) != 0 {
|
||||
// Anonymous record, probably inside a typedef.
|
||||
location := f.getUniqueLocationID(pos, cursor)
|
||||
name = f.getUnnamedDeclName("_Ctype_"+cgoRecordPrefix+"__", location)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build !byollvm && !llvm14
|
||||
//go:build !byollvm && llvm15
|
||||
|
||||
package cgo
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//go:build !byollvm && !llvm14 && !llvm15
|
||||
|
||||
package cgo
|
||||
|
||||
// As of 2023-05-05, there is a packaging issue on Debian:
|
||||
// https://github.com/llvm/llvm-project/issues/62199
|
||||
// A workaround is to fix this locally, using something like this:
|
||||
//
|
||||
// ln -sf ../../x86_64-linux-gnu/libclang-16.so.1 /usr/lib/llvm-16/lib/libclang.so
|
||||
|
||||
/*
|
||||
#cgo linux CFLAGS: -I/usr/lib/llvm-16/include
|
||||
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@16/include
|
||||
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@16/include
|
||||
#cgo freebsd CFLAGS: -I/usr/local/llvm16/include
|
||||
#cgo linux LDFLAGS: -L/usr/lib/llvm-16/lib -lclang
|
||||
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@16/lib -lclang -lffi
|
||||
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@16/lib -lclang -lffi
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/llvm16/lib -lclang
|
||||
*/
|
||||
import "C"
|
||||
@@ -77,6 +77,10 @@ CXType tinygo_clang_getEnumDeclIntegerType(CXCursor c) {
|
||||
return clang_getEnumDeclIntegerType(c);
|
||||
}
|
||||
|
||||
unsigned tinygo_clang_Cursor_isAnonymous(CXCursor c) {
|
||||
return clang_Cursor_isAnonymous(c);
|
||||
}
|
||||
|
||||
unsigned tinygo_clang_Cursor_isBitField(CXCursor c) {
|
||||
return clang_Cursor_isBitField(c);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+8
@@ -22,8 +22,12 @@ import "C"
|
||||
// #warning another warning
|
||||
import "C"
|
||||
|
||||
// #include <stdint.h>
|
||||
import "C"
|
||||
|
||||
// Make sure that errors for the following lines won't change with future
|
||||
// additions to the CGo preamble.
|
||||
//
|
||||
//line errors.go:100
|
||||
var (
|
||||
// constant too large
|
||||
@@ -38,4 +42,8 @@ var (
|
||||
_ byte = C.SOME_CONST_3
|
||||
|
||||
_ = C.SOME_CONST_4
|
||||
|
||||
// This must result in a type error. Previously, TinyGo would allow this
|
||||
// code (which is not allowed by upstream Go).
|
||||
_ int8 = C.int8_t(5)
|
||||
)
|
||||
|
||||
Vendored
+5
-2
@@ -11,6 +11,7 @@
|
||||
// testdata/errors.go:108: undefined: C.SOME_CONST_1
|
||||
// testdata/errors.go:110: cannot use C.SOME_CONST_3 (untyped int constant 1234) as byte value in variable declaration (overflows)
|
||||
// testdata/errors.go:112: undefined: C.SOME_CONST_4
|
||||
// testdata/errors.go:116: cannot use C.int8_t(5) (constant 5 of type C.schar) as int8 value in variable declaration
|
||||
|
||||
package main
|
||||
|
||||
@@ -51,10 +52,12 @@ type (
|
||||
C.longlong int64
|
||||
C.ulonglong uint64
|
||||
)
|
||||
type C._Ctype_struct___0 struct {
|
||||
type C.struct_point_t struct {
|
||||
x C.int
|
||||
y C.int
|
||||
}
|
||||
type C.point_t = C._Ctype_struct___0
|
||||
type C.point_t = C.struct_point_t
|
||||
|
||||
const C.SOME_CONST_3 = 1234
|
||||
|
||||
type C.int8_t = C.schar
|
||||
|
||||
Vendored
+34
-36
@@ -38,11 +38,11 @@ type (
|
||||
C.ulonglong uint64
|
||||
)
|
||||
type C.myint = C.int
|
||||
type C._Ctype_struct___0 struct {
|
||||
type C.struct_point2d_t struct {
|
||||
x C.int
|
||||
y C.int
|
||||
}
|
||||
type C.point2d_t = C._Ctype_struct___0
|
||||
type C.point2d_t = C.struct_point2d_t
|
||||
type C.struct_point3d struct {
|
||||
x C.int
|
||||
y C.int
|
||||
@@ -55,21 +55,19 @@ type C.struct_type1 struct {
|
||||
___type C.int
|
||||
}
|
||||
type C.struct_type2 struct{ _type C.int }
|
||||
type C._Ctype_union___1 struct{ i C.int }
|
||||
type C.union1_t = C._Ctype_union___1
|
||||
type C._Ctype_union___2 struct{ $union uint64 }
|
||||
type C.union_union1_t struct{ i C.int }
|
||||
type C.union1_t = C.union_union1_t
|
||||
type C.union_union3_t struct{ $union uint64 }
|
||||
|
||||
func (union *C._Ctype_union___2) unionfield_i() *C.int {
|
||||
return (*C.int)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
func (union *C._Ctype_union___2) unionfield_d() *float64 {
|
||||
func (union *C.union_union3_t) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
|
||||
func (union *C.union_union3_t) unionfield_d() *float64 {
|
||||
return (*float64)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
func (union *C._Ctype_union___2) unionfield_s() *C.short {
|
||||
func (union *C.union_union3_t) unionfield_s() *C.short {
|
||||
return (*C.short)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
|
||||
type C.union3_t = C._Ctype_union___2
|
||||
type C.union3_t = C.union_union3_t
|
||||
type C.union_union2d struct{ $union [2]uint64 }
|
||||
|
||||
func (union *C.union_union2d) unionfield_i() *C.int { return (*C.int)(unsafe.Pointer(&union.$union)) }
|
||||
@@ -78,50 +76,50 @@ func (union *C.union_union2d) unionfield_d() *[2]float64 {
|
||||
}
|
||||
|
||||
type C.union2d_t = C.union_union2d
|
||||
type C._Ctype_union___3 struct{ arr [10]C.uchar }
|
||||
type C.unionarray_t = C._Ctype_union___3
|
||||
type C._Ctype_union___5 struct{ $union [3]uint32 }
|
||||
type C.union_unionarray_t struct{ arr [10]C.uchar }
|
||||
type C.unionarray_t = C.union_unionarray_t
|
||||
type C._Ctype_union___0 struct{ $union [3]uint32 }
|
||||
|
||||
func (union *C._Ctype_union___5) unionfield_area() *C.point2d_t {
|
||||
func (union *C._Ctype_union___0) unionfield_area() *C.point2d_t {
|
||||
return (*C.point2d_t)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
func (union *C._Ctype_union___5) unionfield_solid() *C.point3d_t {
|
||||
func (union *C._Ctype_union___0) unionfield_solid() *C.point3d_t {
|
||||
return (*C.point3d_t)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
|
||||
type C._Ctype_struct___4 struct {
|
||||
type C.struct_struct_nested_t struct {
|
||||
begin C.point2d_t
|
||||
end C.point2d_t
|
||||
tag C.int
|
||||
|
||||
coord C._Ctype_union___5
|
||||
coord C._Ctype_union___0
|
||||
}
|
||||
type C.struct_nested_t = C._Ctype_struct___4
|
||||
type C._Ctype_union___6 struct{ $union [2]uint64 }
|
||||
type C.struct_nested_t = C.struct_struct_nested_t
|
||||
type C.union_union_nested_t struct{ $union [2]uint64 }
|
||||
|
||||
func (union *C._Ctype_union___6) unionfield_point() *C.point3d_t {
|
||||
func (union *C.union_union_nested_t) unionfield_point() *C.point3d_t {
|
||||
return (*C.point3d_t)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
func (union *C._Ctype_union___6) unionfield_array() *C.unionarray_t {
|
||||
func (union *C.union_union_nested_t) unionfield_array() *C.unionarray_t {
|
||||
return (*C.unionarray_t)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
func (union *C._Ctype_union___6) unionfield_thing() *C.union3_t {
|
||||
func (union *C.union_union_nested_t) unionfield_thing() *C.union3_t {
|
||||
return (*C.union3_t)(unsafe.Pointer(&union.$union))
|
||||
}
|
||||
|
||||
type C.union_nested_t = C._Ctype_union___6
|
||||
type C.union_nested_t = C.union_union_nested_t
|
||||
type C.enum_option = C.int
|
||||
type C.option_t = C.enum_option
|
||||
type C._Ctype_enum___7 = C.uint
|
||||
type C.option2_t = C._Ctype_enum___7
|
||||
type C._Ctype_struct___8 struct {
|
||||
type C.enum_option2_t = C.uint
|
||||
type C.option2_t = C.enum_option2_t
|
||||
type C.struct_types_t struct {
|
||||
f float32
|
||||
d float64
|
||||
ptr *C.int
|
||||
}
|
||||
type C.types_t = C._Ctype_struct___8
|
||||
type C.types_t = C.struct_types_t
|
||||
type C.myIntArray = [10]C.int
|
||||
type C._Ctype_struct___9 struct {
|
||||
type C.struct_bitfield_t struct {
|
||||
start C.uchar
|
||||
__bitfield_1 C.uchar
|
||||
|
||||
@@ -129,21 +127,21 @@ type C._Ctype_struct___9 struct {
|
||||
e C.uchar
|
||||
}
|
||||
|
||||
func (s *C._Ctype_struct___9) bitfield_a() C.uchar { return s.__bitfield_1 & 0x1f }
|
||||
func (s *C._Ctype_struct___9) set_bitfield_a(value C.uchar) {
|
||||
func (s *C.struct_bitfield_t) bitfield_a() C.uchar { return s.__bitfield_1 & 0x1f }
|
||||
func (s *C.struct_bitfield_t) set_bitfield_a(value C.uchar) {
|
||||
s.__bitfield_1 = s.__bitfield_1&^0x1f | value&0x1f<<0
|
||||
}
|
||||
func (s *C._Ctype_struct___9) bitfield_b() C.uchar {
|
||||
func (s *C.struct_bitfield_t) bitfield_b() C.uchar {
|
||||
return s.__bitfield_1 >> 5 & 0x1
|
||||
}
|
||||
func (s *C._Ctype_struct___9) set_bitfield_b(value C.uchar) {
|
||||
func (s *C.struct_bitfield_t) set_bitfield_b(value C.uchar) {
|
||||
s.__bitfield_1 = s.__bitfield_1&^0x20 | value&0x1<<5
|
||||
}
|
||||
func (s *C._Ctype_struct___9) bitfield_c() C.uchar {
|
||||
func (s *C.struct_bitfield_t) bitfield_c() C.uchar {
|
||||
return s.__bitfield_1 >> 6
|
||||
}
|
||||
func (s *C._Ctype_struct___9) set_bitfield_c(value C.uchar,
|
||||
func (s *C.struct_bitfield_t) set_bitfield_c(value C.uchar,
|
||||
|
||||
) { s.__bitfield_1 = s.__bitfield_1&0x3f | value<<6 }
|
||||
|
||||
type C.bitfield_t = C._Ctype_struct___9
|
||||
type C.bitfield_t = C.struct_bitfield_t
|
||||
|
||||
@@ -281,10 +281,14 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) {
|
||||
}
|
||||
case "arm64":
|
||||
spec.CPU = "generic"
|
||||
spec.Features = "+neon"
|
||||
if goos == "darwin" {
|
||||
spec.Features = "+neon"
|
||||
} else { // windows, linux
|
||||
spec.Features = "+neon,-fmv"
|
||||
}
|
||||
case "wasm":
|
||||
spec.CPU = "generic"
|
||||
spec.Features = "+bulk-memory,+nontrapping-fptoint,+sign-ext"
|
||||
spec.Features = "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext"
|
||||
spec.BuildTags = append(spec.BuildTags, "tinygo.wasm")
|
||||
spec.CFlags = append(spec.CFlags,
|
||||
"-mbulk-memory",
|
||||
@@ -340,7 +344,7 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) {
|
||||
spec.Linker = "wasm-ld"
|
||||
spec.RTLib = "compiler-rt"
|
||||
spec.Libc = "wasi-libc"
|
||||
spec.DefaultStackSize = 1024 * 16 // 16kB
|
||||
spec.DefaultStackSize = 1024 * 32 // 32kB
|
||||
spec.LDFlags = append(spec.LDFlags,
|
||||
"--stack-first",
|
||||
"--no-demangle",
|
||||
|
||||
@@ -3005,6 +3005,11 @@ func (c *compilerContext) createConst(expr *ssa.Const, pos token.Pos) llvm.Value
|
||||
panic("expected nil pointer constant")
|
||||
}
|
||||
return llvm.ConstPointerNull(c.getLLVMType(typ))
|
||||
case *types.Array:
|
||||
if expr.Value != nil {
|
||||
panic("expected nil array constant")
|
||||
}
|
||||
return llvm.ConstNull(c.getLLVMType(expr.Type()))
|
||||
case *types.Slice:
|
||||
if expr.Value != nil {
|
||||
panic("expected nil slice constant")
|
||||
@@ -3018,6 +3023,11 @@ func (c *compilerContext) createConst(expr *ssa.Const, pos token.Pos) llvm.Value
|
||||
llvmLen, // cap
|
||||
}, false)
|
||||
return slice
|
||||
case *types.Struct:
|
||||
if expr.Value != nil {
|
||||
panic("expected nil struct constant")
|
||||
}
|
||||
return llvm.ConstNull(c.getLLVMType(expr.Type()))
|
||||
case *types.Map:
|
||||
if !expr.IsNil() {
|
||||
// I believe this is not allowed by the Go spec.
|
||||
|
||||
@@ -147,7 +147,7 @@ func (c *compilerContext) getTypeCode(typ types.Type) llvm.Value {
|
||||
c.addError(token.NoPos, fmt.Sprintf("too many levels of pointers for typecode: %s", typstr))
|
||||
}
|
||||
return llvm.ConstGEP(c.ctx.Int8Type(), ptr, []llvm.Value{
|
||||
llvm.ConstInt(llvm.Int32Type(), 1, false),
|
||||
llvm.ConstInt(c.ctx.Int32Type(), 1, false),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -218,6 +218,7 @@ func (c *compilerContext) getTypeCode(typ types.Type) llvm.Value {
|
||||
types.NewVar(token.NoPos, nil, "ptrTo", types.Typ[types.UnsafePointer]),
|
||||
types.NewVar(token.NoPos, nil, "elementType", types.Typ[types.UnsafePointer]),
|
||||
types.NewVar(token.NoPos, nil, "length", types.Typ[types.Uintptr]),
|
||||
types.NewVar(token.NoPos, nil, "sliceOf", types.Typ[types.UnsafePointer]),
|
||||
)
|
||||
case *types.Map:
|
||||
typeFieldTypes = append(typeFieldTypes,
|
||||
@@ -326,6 +327,7 @@ func (c *compilerContext) getTypeCode(typ types.Type) llvm.Value {
|
||||
c.getTypeCode(types.NewPointer(typ)), // ptrTo
|
||||
c.getTypeCode(typ.Elem()), // elementType
|
||||
llvm.ConstInt(c.uintptrType, uint64(typ.Len()), false), // length
|
||||
c.getTypeCode(types.NewSlice(typ.Elem())), // slicePtr
|
||||
}
|
||||
case *types.Map:
|
||||
typeFields = []llvm.Value{
|
||||
@@ -450,8 +452,8 @@ func (c *compilerContext) getTypeCode(typ types.Type) llvm.Value {
|
||||
offset = 1
|
||||
}
|
||||
return llvm.ConstGEP(global.GlobalValueType(), global, []llvm.Value{
|
||||
llvm.ConstInt(llvm.Int32Type(), 0, false),
|
||||
llvm.ConstInt(llvm.Int32Type(), offset, false),
|
||||
llvm.ConstInt(c.ctx.Int32Type(), 0, false),
|
||||
llvm.ConstInt(c.ctx.Int32Type(), offset, false),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ func (c *compilerContext) getFunction(fn *ssa.Function) (llvm.Type, llvm.Value)
|
||||
if strings.Split(c.Triple, "-")[0] == "avr" {
|
||||
// These functions are compiler-rt/libgcc functions that are
|
||||
// currently implemented in Go. Assembly versions should appear in
|
||||
// LLVM 16 hopefully. Until then, they need to be made available to
|
||||
// LLVM 17 hopefully. Until then, they need to be made available to
|
||||
// the linker and the best way to do that is llvm.compiler.used.
|
||||
// I considered adding a pragma for this, but the LLVM language
|
||||
// reference explicitly says that this feature should not be exposed
|
||||
|
||||
Vendored
+3
-12
@@ -196,10 +196,6 @@ entry:
|
||||
; Function Attrs: nounwind
|
||||
define hidden void @main.foo(ptr %context) unnamed_addr #2 {
|
||||
entry:
|
||||
%complit = alloca %main.kv.0, align 8
|
||||
%stackalloc = alloca i8, align 1
|
||||
store %main.kv.0 zeroinitializer, ptr %complit, align 8
|
||||
call void @runtime.trackPointer(ptr nonnull %complit, ptr nonnull %stackalloc, ptr undef) #3
|
||||
call void @"main.foo$1"(%main.kv.0 zeroinitializer, ptr undef)
|
||||
ret void
|
||||
}
|
||||
@@ -207,15 +203,10 @@ entry:
|
||||
; Function Attrs: nounwind
|
||||
define internal void @"main.foo$1"(%main.kv.0 %b, ptr %context) unnamed_addr #2 {
|
||||
entry:
|
||||
%b1 = alloca %main.kv.0, align 8
|
||||
%stackalloc = alloca i8, align 1
|
||||
store %main.kv.0 zeroinitializer, ptr %b1, align 8
|
||||
call void @runtime.trackPointer(ptr nonnull %b1, ptr nonnull %stackalloc, ptr undef) #3
|
||||
store %main.kv.0 %b, ptr %b1, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind }
|
||||
|
||||
Vendored
+6
-9
@@ -31,12 +31,12 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
|
||||
|
||||
declare void @runtime.chanSend(ptr dereferenceable_or_null(32), ptr, ptr dereferenceable_or_null(24), ptr) #1
|
||||
|
||||
; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
|
||||
|
||||
; Function Attrs: nounwind
|
||||
@@ -57,10 +57,7 @@ declare i1 @runtime.chanRecv(ptr dereferenceable_or_null(32), ptr, ptr dereferen
|
||||
; Function Attrs: nounwind
|
||||
define hidden void @main.chanZeroSend(ptr dereferenceable_or_null(32) %ch, ptr %context) unnamed_addr #2 {
|
||||
entry:
|
||||
%complit = alloca {}, align 8
|
||||
%chan.blockedList = alloca %runtime.channelBlockedList, align 8
|
||||
%stackalloc = alloca i8, align 1
|
||||
call void @runtime.trackPointer(ptr nonnull %complit, ptr nonnull %stackalloc, ptr undef) #4
|
||||
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %chan.blockedList)
|
||||
call void @runtime.chanSend(ptr %ch, ptr null, ptr nonnull %chan.blockedList, ptr undef) #4
|
||||
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %chan.blockedList)
|
||||
@@ -110,8 +107,8 @@ select.body: ; preds = %select.next
|
||||
|
||||
declare { i32, i1 } @runtime.tryChanSelect(ptr, ptr, i32, i32, ptr) #1
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { argmemonly nocallback nofree nosync nounwind willreturn }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
||||
attributes #4 = { nounwind }
|
||||
|
||||
Vendored
+3
-3
@@ -93,6 +93,6 @@ entry:
|
||||
ret i8 %0
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
|
||||
Vendored
+3
-3
@@ -44,7 +44,7 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind }
|
||||
|
||||
Vendored
+3
-3
@@ -135,7 +135,7 @@ entry:
|
||||
ret %runtime._interface %1
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind }
|
||||
|
||||
Vendored
+3
-3
@@ -57,7 +57,7 @@ entry:
|
||||
ret ptr %s.data
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind }
|
||||
|
||||
Vendored
+11
-11
@@ -138,7 +138,7 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: argmemonly nocallback nofree nounwind willreturn writeonly
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg) #3
|
||||
|
||||
; Function Attrs: nounwind
|
||||
@@ -156,24 +156,24 @@ entry:
|
||||
|
||||
declare void @runtime.hashmapClear(ptr dereferenceable_or_null(40), ptr) #1
|
||||
|
||||
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
||||
declare i32 @llvm.smin.i32(i32, i32) #4
|
||||
|
||||
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
||||
declare i8 @llvm.umin.i8(i8, i8) #4
|
||||
|
||||
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
||||
declare i32 @llvm.umin.i32(i32, i32) #4
|
||||
|
||||
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
||||
declare i32 @llvm.smax.i32(i32, i32) #4
|
||||
|
||||
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
|
||||
declare i32 @llvm.umax.i32(i32, i32) #4
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { argmemonly nocallback nofree nounwind willreturn writeonly }
|
||||
attributes #4 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
|
||||
attributes #5 = { nounwind }
|
||||
|
||||
+14
-14
@@ -21,7 +21,7 @@ entry:
|
||||
; Function Attrs: nounwind
|
||||
define hidden void @main.regularFunctionGoroutine(ptr %context) unnamed_addr #2 {
|
||||
entry:
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.regularFunction$gowrapper" to i32), ptr nonnull inttoptr (i32 5 to ptr), i32 16384, ptr undef) #9
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.regularFunction$gowrapper" to i32), ptr nonnull inttoptr (i32 5 to ptr), i32 32768, ptr undef) #9
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ declare void @"internal/task.start"(i32, ptr, i32, ptr) #1
|
||||
; Function Attrs: nounwind
|
||||
define hidden void @main.inlineFunctionGoroutine(ptr %context) unnamed_addr #2 {
|
||||
entry:
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.inlineFunctionGoroutine$1$gowrapper" to i32), ptr nonnull inttoptr (i32 5 to ptr), i32 16384, ptr undef) #9
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.inlineFunctionGoroutine$1$gowrapper" to i32), ptr nonnull inttoptr (i32 5 to ptr), i32 32768, ptr undef) #9
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ entry:
|
||||
store i32 5, ptr %0, align 4
|
||||
%1 = getelementptr inbounds { i32, ptr }, ptr %0, i32 0, i32 1
|
||||
store ptr %n, ptr %1, align 4
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr nonnull %0, i32 16384, ptr undef) #9
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr nonnull %0, i32 32768, ptr undef) #9
|
||||
%2 = load i32, ptr %n, align 4
|
||||
call void @runtime.printint32(i32 %2, ptr undef) #9
|
||||
ret void
|
||||
@@ -113,7 +113,7 @@ entry:
|
||||
store ptr %fn.context, ptr %1, align 4
|
||||
%2 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 2
|
||||
store ptr %fn.funcptr, ptr %2, align 4
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr nonnull %0, i32 16384, ptr undef) #9
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr nonnull %0, i32 32768, ptr undef) #9
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ entry:
|
||||
store i32 4, ptr %.repack1, align 4
|
||||
%2 = getelementptr inbounds { ptr, %runtime._string, ptr }, ptr %0, i32 0, i32 2
|
||||
store ptr %itf.typecode, ptr %2, align 4
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr nonnull %0, i32 16384, ptr undef) #9
|
||||
call void @"internal/task.start"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr nonnull %0, i32 32768, ptr undef) #9
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -188,13 +188,13 @@ entry:
|
||||
unreachable
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.regularFunction" }
|
||||
attributes #4 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.inlineFunctionGoroutine$1" }
|
||||
attributes #5 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.closureFunctionGoroutine$1" }
|
||||
attributes #6 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper" }
|
||||
attributes #7 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="reflect/methods.Print(string)" "tinygo-methods"="reflect/methods.Print(string)" }
|
||||
attributes #8 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="interface:{Print:func:{basic:string}{}}.Print$invoke" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.regularFunction" }
|
||||
attributes #4 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.inlineFunctionGoroutine$1" }
|
||||
attributes #5 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="main.closureFunctionGoroutine$1" }
|
||||
attributes #6 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper" }
|
||||
attributes #7 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="reflect/methods.Print(string)" "tinygo-methods"="reflect/methods.Print(string)" }
|
||||
attributes #8 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-gowrapper"="interface:{Print:func:{basic:string}{}}.Print$invoke" }
|
||||
attributes #9 = { nounwind }
|
||||
|
||||
Vendored
+7
-7
@@ -130,11 +130,11 @@ entry:
|
||||
|
||||
declare %runtime._string @"interface:{Error:func:{}{basic:string}}.Error$invoke"(ptr, ptr, ptr) #6
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-methods"="reflect/methods.Error() string" }
|
||||
attributes #4 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-methods"="reflect/methods.String() string" }
|
||||
attributes #5 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="main.$methods.foo(int) uint8" "tinygo-methods"="reflect/methods.String() string; main.$methods.foo(int) uint8" }
|
||||
attributes #6 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="reflect/methods.Error() string" "tinygo-methods"="reflect/methods.Error() string" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-methods"="reflect/methods.Error() string" }
|
||||
attributes #4 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-methods"="reflect/methods.String() string" }
|
||||
attributes #5 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="main.$methods.foo(int) uint8" "tinygo-methods"="reflect/methods.String() string; main.$methods.foo(int) uint8" }
|
||||
attributes #6 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "tinygo-invoke"="reflect/methods.Error() string" "tinygo-methods"="reflect/methods.Error() string" }
|
||||
attributes #7 = { nounwind }
|
||||
|
||||
Vendored
+3
-3
@@ -44,7 +44,7 @@ entry:
|
||||
ret ptr %x
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind }
|
||||
|
||||
Vendored
+10
-10
@@ -72,13 +72,13 @@ entry:
|
||||
|
||||
declare void @main.undefinedFunctionNotInSection(ptr) #1
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="extern_func" }
|
||||
attributes #4 = { inlinehint nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #5 = { noinline nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #6 = { noinline nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="exportedFunctionInSection" }
|
||||
attributes #7 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "wasm-import-module"="modulename" "wasm-import-name"="import1" }
|
||||
attributes #8 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "wasm-import-module"="foobar" "wasm-import-name"="imported" }
|
||||
attributes #9 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="exported" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="extern_func" }
|
||||
attributes #4 = { inlinehint nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #5 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #6 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="exportedFunctionInSection" }
|
||||
attributes #7 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-import-module"="modulename" "wasm-import-name"="import1" }
|
||||
attributes #8 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-import-module"="foobar" "wasm-import-name"="imported" }
|
||||
attributes #9 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" "wasm-export-name"="exported" }
|
||||
|
||||
Vendored
+3
-3
@@ -322,7 +322,7 @@ unsafe.Slice.throw: ; preds = %entry
|
||||
unreachable
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind }
|
||||
|
||||
Vendored
+3
-3
@@ -97,7 +97,7 @@ lookup.throw: ; preds = %entry
|
||||
unreachable
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { nounwind }
|
||||
|
||||
Vendored
+17
-49
@@ -21,14 +21,9 @@ define hidden i32 @main.testZeroGet(ptr dereferenceable_or_null(40) %m, i1 %s.b1
|
||||
entry:
|
||||
%hashmap.key = alloca %main.hasPadding, align 8
|
||||
%hashmap.value = alloca i32, align 4
|
||||
%s = alloca %main.hasPadding, align 8
|
||||
%0 = insertvalue %main.hasPadding zeroinitializer, i1 %s.b1, 0
|
||||
%1 = insertvalue %main.hasPadding %0, i32 %s.i, 1
|
||||
%2 = insertvalue %main.hasPadding %1, i1 %s.b2, 2
|
||||
%stackalloc = alloca i8, align 1
|
||||
store %main.hasPadding zeroinitializer, ptr %s, align 8
|
||||
call void @runtime.trackPointer(ptr nonnull %s, ptr nonnull %stackalloc, ptr undef) #5
|
||||
store %main.hasPadding %2, ptr %s, align 8
|
||||
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value)
|
||||
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %hashmap.key)
|
||||
store %main.hasPadding %2, ptr %hashmap.key, align 8
|
||||
@@ -43,14 +38,14 @@ entry:
|
||||
ret i32 %6
|
||||
}
|
||||
|
||||
; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
|
||||
|
||||
declare void @runtime.memzero(ptr, i32, ptr) #1
|
||||
|
||||
declare i1 @runtime.hashmapBinaryGet(ptr dereferenceable_or_null(40), ptr, ptr, i32, ptr) #1
|
||||
|
||||
; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
|
||||
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
|
||||
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
|
||||
|
||||
; Function Attrs: noinline nounwind
|
||||
@@ -58,14 +53,9 @@ define hidden void @main.testZeroSet(ptr dereferenceable_or_null(40) %m, i1 %s.b
|
||||
entry:
|
||||
%hashmap.key = alloca %main.hasPadding, align 8
|
||||
%hashmap.value = alloca i32, align 4
|
||||
%s = alloca %main.hasPadding, align 8
|
||||
%0 = insertvalue %main.hasPadding zeroinitializer, i1 %s.b1, 0
|
||||
%1 = insertvalue %main.hasPadding %0, i32 %s.i, 1
|
||||
%2 = insertvalue %main.hasPadding %1, i1 %s.b2, 2
|
||||
%stackalloc = alloca i8, align 1
|
||||
store %main.hasPadding zeroinitializer, ptr %s, align 8
|
||||
call void @runtime.trackPointer(ptr nonnull %s, ptr nonnull %stackalloc, ptr undef) #5
|
||||
store %main.hasPadding %2, ptr %s, align 8
|
||||
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value)
|
||||
store i32 5, ptr %hashmap.value, align 4
|
||||
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %hashmap.key)
|
||||
@@ -87,24 +77,13 @@ define hidden i32 @main.testZeroArrayGet(ptr dereferenceable_or_null(40) %m, [2
|
||||
entry:
|
||||
%hashmap.key = alloca [2 x %main.hasPadding], align 8
|
||||
%hashmap.value = alloca i32, align 4
|
||||
%s1 = alloca [2 x %main.hasPadding], align 8
|
||||
%stackalloc = alloca i8, align 1
|
||||
store %main.hasPadding zeroinitializer, ptr %s1, align 8
|
||||
%s1.repack2 = getelementptr inbounds [2 x %main.hasPadding], ptr %s1, i32 0, i32 1
|
||||
store %main.hasPadding zeroinitializer, ptr %s1.repack2, align 4
|
||||
call void @runtime.trackPointer(ptr nonnull %s1, ptr nonnull %stackalloc, ptr undef) #5
|
||||
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
||||
store %main.hasPadding %s.elt, ptr %s1, align 8
|
||||
%s1.repack3 = getelementptr inbounds [2 x %main.hasPadding], ptr %s1, i32 0, i32 1
|
||||
%s.elt4 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||
store %main.hasPadding %s.elt4, ptr %s1.repack3, align 4
|
||||
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value)
|
||||
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key)
|
||||
%s.elt7 = extractvalue [2 x %main.hasPadding] %s, 0
|
||||
store %main.hasPadding %s.elt7, ptr %hashmap.key, align 8
|
||||
%hashmap.key.repack8 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1
|
||||
%s.elt9 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||
store %main.hasPadding %s.elt9, ptr %hashmap.key.repack8, align 4
|
||||
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
||||
store %main.hasPadding %s.elt, ptr %hashmap.key, align 8
|
||||
%hashmap.key.repack1 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1
|
||||
%s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||
store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4
|
||||
%0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1
|
||||
call void @runtime.memzero(ptr nonnull %0, i32 3, ptr undef) #5
|
||||
%1 = getelementptr inbounds i8, ptr %hashmap.key, i32 9
|
||||
@@ -125,25 +104,14 @@ define hidden void @main.testZeroArraySet(ptr dereferenceable_or_null(40) %m, [2
|
||||
entry:
|
||||
%hashmap.key = alloca [2 x %main.hasPadding], align 8
|
||||
%hashmap.value = alloca i32, align 4
|
||||
%s1 = alloca [2 x %main.hasPadding], align 8
|
||||
%stackalloc = alloca i8, align 1
|
||||
store %main.hasPadding zeroinitializer, ptr %s1, align 8
|
||||
%s1.repack2 = getelementptr inbounds [2 x %main.hasPadding], ptr %s1, i32 0, i32 1
|
||||
store %main.hasPadding zeroinitializer, ptr %s1.repack2, align 4
|
||||
call void @runtime.trackPointer(ptr nonnull %s1, ptr nonnull %stackalloc, ptr undef) #5
|
||||
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
||||
store %main.hasPadding %s.elt, ptr %s1, align 8
|
||||
%s1.repack3 = getelementptr inbounds [2 x %main.hasPadding], ptr %s1, i32 0, i32 1
|
||||
%s.elt4 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||
store %main.hasPadding %s.elt4, ptr %s1.repack3, align 4
|
||||
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value)
|
||||
store i32 5, ptr %hashmap.value, align 4
|
||||
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key)
|
||||
%s.elt7 = extractvalue [2 x %main.hasPadding] %s, 0
|
||||
store %main.hasPadding %s.elt7, ptr %hashmap.key, align 8
|
||||
%hashmap.key.repack8 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1
|
||||
%s.elt9 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||
store %main.hasPadding %s.elt9, ptr %hashmap.key.repack8, align 4
|
||||
%s.elt = extractvalue [2 x %main.hasPadding] %s, 0
|
||||
store %main.hasPadding %s.elt, ptr %hashmap.key, align 8
|
||||
%hashmap.key.repack1 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1
|
||||
%s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1
|
||||
store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4
|
||||
%0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1
|
||||
call void @runtime.memzero(ptr nonnull %0, i32 3, ptr undef) #5
|
||||
%1 = getelementptr inbounds i8, ptr %hashmap.key, i32 9
|
||||
@@ -164,9 +132,9 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { noinline nounwind "target-features"="+bulk-memory,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #4 = { argmemonly nocallback nofree nosync nounwind willreturn }
|
||||
attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #3 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" }
|
||||
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
|
||||
attributes #5 = { nounwind }
|
||||
|
||||
@@ -15,10 +15,10 @@ require (
|
||||
github.com/mattn/go-tty v0.0.4
|
||||
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3
|
||||
go.bug.st/serial v1.6.0
|
||||
golang.org/x/sys v0.4.0
|
||||
golang.org/x/tools v0.5.1-0.20230114154351-e035d0c426c8
|
||||
golang.org/x/sys v0.11.0
|
||||
golang.org/x/tools v0.12.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
tinygo.org/x/go-llvm v0.0.0-20221028183034-8341240c0b32
|
||||
tinygo.org/x/go-llvm v0.0.0-20230918183930-9edb6403d0bc
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -12,8 +12,6 @@ github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moA
|
||||
github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0=
|
||||
github.com/creack/goselect v0.1.2/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY=
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/deadprogram/go-serial v0.0.0-20230717164825-4529b3232919 h1:Hi7G1bCG70NwlyqGswJKEHoIi4hJVN1SsmfwZ+DQHtw=
|
||||
github.com/deadprogram/go-serial v0.0.0-20230717164825-4529b3232919/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE=
|
||||
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
|
||||
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
|
||||
github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
|
||||
@@ -50,7 +48,7 @@ github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3/go.mod h1:9/etS5gpQq9
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
go.bug.st/serial v1.6.0 h1:mAbRGN4cKE2J5gMwsMHC2KQisdLRQssO9WSM+rbZJ8A=
|
||||
go.bug.st/serial v1.6.0/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE=
|
||||
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
|
||||
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -58,14 +56,14 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
|
||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/tools v0.5.1-0.20230114154351-e035d0c426c8 h1:LHoToPgySGSr2NcUHbjENAidHz38RkKaNmmntwn9TjI=
|
||||
golang.org/x/tools v0.5.1-0.20230114154351-e035d0c426c8/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
|
||||
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
tinygo.org/x/go-llvm v0.0.0-20221028183034-8341240c0b32 h1:LvdmoXncO43m2cws1chRB2hkLBAxfN6CbSjDI7+gk4Y=
|
||||
tinygo.org/x/go-llvm v0.0.0-20221028183034-8341240c0b32/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=
|
||||
tinygo.org/x/go-llvm v0.0.0-20230918183930-9edb6403d0bc h1:IVX1dqCX3c88P7iEMBtz1xCAM4UIqCMgbqHdSefBaWE=
|
||||
tinygo.org/x/go-llvm v0.0.0-20230918183930-9edb6403d0bc/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// Version of TinyGo.
|
||||
// Update this value before release of new version of software.
|
||||
const Version = "0.29.0"
|
||||
const Version = "0.30.0"
|
||||
|
||||
var (
|
||||
// This variable is set at build time using -ldflags parameters.
|
||||
|
||||
+4
-1
@@ -49,7 +49,10 @@ func (inst *instruction) String() string {
|
||||
operands[i] = op.String()
|
||||
}
|
||||
|
||||
name := instructionNameMap[inst.opcode]
|
||||
name := ""
|
||||
if int(inst.opcode) < len(instructionNameMap) {
|
||||
name = instructionNameMap[inst.opcode]
|
||||
}
|
||||
if name == "" {
|
||||
name = "<unknown op>"
|
||||
}
|
||||
|
||||
+4
-4
@@ -35,14 +35,14 @@ func isRecoverableError(err error) bool {
|
||||
// ErrorLine is one line in a traceback. The position may be missing.
|
||||
type ErrorLine struct {
|
||||
Pos token.Position
|
||||
Inst llvm.Value
|
||||
Inst string
|
||||
}
|
||||
|
||||
// Error encapsulates compile-time interpretation errors with an associated
|
||||
// import path. The errors may not have a precise location attached.
|
||||
type Error struct {
|
||||
ImportPath string
|
||||
Inst llvm.Value
|
||||
Inst string
|
||||
Pos token.Position
|
||||
Err error
|
||||
Traceback []ErrorLine
|
||||
@@ -60,10 +60,10 @@ func (r *runner) errorAt(inst instruction, err error) *Error {
|
||||
pos := getPosition(inst.llvmInst)
|
||||
return &Error{
|
||||
ImportPath: r.pkgName,
|
||||
Inst: inst.llvmInst,
|
||||
Inst: inst.String(),
|
||||
Pos: pos,
|
||||
Err: err,
|
||||
Traceback: []ErrorLine{{pos, inst.llvmInst}},
|
||||
Traceback: []ErrorLine{{pos, inst.String()}},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,16 +57,14 @@ func runTest(t *testing.T, pathPrefix string) {
|
||||
if err != nil {
|
||||
if err, match := err.(*Error); match {
|
||||
println(err.Error())
|
||||
if !err.Inst.IsNil() {
|
||||
err.Inst.Dump()
|
||||
println()
|
||||
if len(err.Inst) != 0 {
|
||||
println(err.Inst)
|
||||
}
|
||||
if len(err.Traceback) > 0 {
|
||||
println("\ntraceback:")
|
||||
for _, line := range err.Traceback {
|
||||
println(line.Pos.String() + ":")
|
||||
line.Inst.Dump()
|
||||
println()
|
||||
println(line.Inst)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-1
@@ -338,6 +338,20 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
||||
if err != nil {
|
||||
return nil, mem, r.errorAt(inst, err)
|
||||
}
|
||||
if mem.hasExternalStore(src) || mem.hasExternalLoadOrStore(dst) {
|
||||
// These are the same checks as there are on llvm.Load
|
||||
// and llvm.Store in the interpreter. Copying is
|
||||
// essentially loading from the source array and storing
|
||||
// to the destination array, hence why we need to do the
|
||||
// same checks here.
|
||||
// This fixes the following bug:
|
||||
// https://github.com/tinygo-org/tinygo/issues/3890
|
||||
err := r.runAtRuntime(fn, inst, locals, &mem, indent)
|
||||
if err != nil {
|
||||
return nil, mem, err
|
||||
}
|
||||
continue
|
||||
}
|
||||
nBytes := uint32(n * elemSize)
|
||||
dstObj := mem.getWritable(dst.index())
|
||||
dstBuf := dstObj.buffer.asRawValue(r)
|
||||
@@ -529,7 +543,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
||||
// how this function got called.
|
||||
callErr.Traceback = append(callErr.Traceback, ErrorLine{
|
||||
Pos: getPosition(inst.llvmInst),
|
||||
Inst: inst.llvmInst,
|
||||
Inst: inst.String(),
|
||||
})
|
||||
return nil, mem, callErr
|
||||
}
|
||||
|
||||
Vendored
+23
@@ -7,6 +7,10 @@ target triple = "x86_64--linux"
|
||||
@main.int16SliceSrc.buf = internal global [3 x i16] [i16 5, i16 123, i16 1024]
|
||||
@main.int16SliceSrc = internal unnamed_addr global { ptr, i64, i64 } { ptr @main.int16SliceSrc.buf, i64 3, i64 3 }
|
||||
@main.int16SliceDst = internal unnamed_addr global { ptr, i64, i64 } zeroinitializer
|
||||
@main.sliceSrcUntaint.buf = internal global [2 x i8] c"ab"
|
||||
@main.sliceDstUntaint.buf = internal global [2 x i8] zeroinitializer
|
||||
@main.sliceSrcTaint.buf = internal global [2 x i8] c"cd"
|
||||
@main.sliceDstTaint.buf = internal global [2 x i8] zeroinitializer
|
||||
|
||||
declare i64 @runtime.sliceCopy(ptr %dst, ptr %src, i64 %dstLen, i64 %srcLen, i64 %elemSize) unnamed_addr
|
||||
|
||||
@@ -16,6 +20,8 @@ declare void @runtime.printuint8(i8)
|
||||
|
||||
declare void @runtime.printint16(i16)
|
||||
|
||||
declare void @use(ptr)
|
||||
|
||||
define void @runtime.initAll() unnamed_addr {
|
||||
entry:
|
||||
call void @main.init()
|
||||
@@ -43,6 +49,15 @@ entry:
|
||||
%int16SliceDst.buf = load ptr, ptr @main.int16SliceDst
|
||||
%int16SliceDst.val = load i16, ptr %int16SliceDst.buf
|
||||
call void @runtime.printint16(i16 %int16SliceDst.val)
|
||||
|
||||
; print(sliceDstUntaint[0])
|
||||
%sliceDstUntaint.val = load i8, ptr getelementptr inbounds (i8, ptr @main.sliceDstUntaint.buf, i32 0)
|
||||
call void @runtime.printuint8(i8 %sliceDstUntaint.val)
|
||||
|
||||
; print(sliceDstTaint[0])
|
||||
%sliceDstTaint.val = load i8, ptr getelementptr inbounds (i8, ptr @main.sliceDstTaint.buf, i32 0)
|
||||
call void @runtime.printuint8(i8 %sliceDstTaint.val)
|
||||
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -79,5 +94,13 @@ entry:
|
||||
%int16SliceSrc.buf = extractvalue { ptr, i64, i64 } %int16SliceSrc, 0
|
||||
%copy.n2 = call i64 @runtime.sliceCopy(ptr %int16SliceDst.buf, ptr %int16SliceSrc.buf, i64 %int16SliceSrc.len, i64 %int16SliceSrc.len, i64 2)
|
||||
|
||||
; Copy slice that has a known value.
|
||||
%copy.n3 = call i64 @runtime.sliceCopy(ptr @main.sliceDstUntaint.buf, ptr @main.sliceSrcUntaint.buf, i64 2, i64 2, i64 1)
|
||||
|
||||
; Copy slice that might have been modified by the external @use call.
|
||||
; This is a fix for https://github.com/tinygo-org/tinygo/issues/3890.
|
||||
call void @use(ptr @main.sliceSrcTaint.buf)
|
||||
%copy.n4 = call i64 @runtime.sliceCopy(ptr @main.sliceDstTaint.buf, ptr @main.sliceSrcTaint.buf, i64 2, i64 2, i64 1)
|
||||
|
||||
ret void
|
||||
}
|
||||
|
||||
Vendored
+12
@@ -1,12 +1,21 @@
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64--linux"
|
||||
|
||||
@main.sliceSrcTaint.buf = internal global [2 x i8] c"cd"
|
||||
@main.sliceDstTaint.buf = internal global [2 x i8] zeroinitializer
|
||||
|
||||
declare i64 @runtime.sliceCopy(ptr, ptr, i64, i64, i64) unnamed_addr
|
||||
|
||||
declare void @runtime.printuint8(i8) local_unnamed_addr
|
||||
|
||||
declare void @runtime.printint16(i16) local_unnamed_addr
|
||||
|
||||
declare void @use(ptr) local_unnamed_addr
|
||||
|
||||
define void @runtime.initAll() unnamed_addr {
|
||||
entry:
|
||||
call void @use(ptr @main.sliceSrcTaint.buf)
|
||||
%copy.n4 = call i64 @runtime.sliceCopy(ptr @main.sliceDstTaint.buf, ptr @main.sliceSrcTaint.buf, i64 2, i64 2, i64 1)
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -16,5 +25,8 @@ entry:
|
||||
call void @runtime.printuint8(i8 3)
|
||||
call void @runtime.printint16(i16 5)
|
||||
call void @runtime.printint16(i16 5)
|
||||
call void @runtime.printuint8(i8 97)
|
||||
%sliceDstTaint.val = load i8, ptr @main.sliceDstTaint.buf, align 1
|
||||
call void @runtime.printuint8(i8 %sliceDstTaint.val)
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -1289,16 +1289,14 @@ func printCompilerError(logln func(...interface{}), err error) {
|
||||
case *interp.Error:
|
||||
logln("#", err.ImportPath)
|
||||
logln(err.Error())
|
||||
if !err.Inst.IsNil() {
|
||||
err.Inst.Dump()
|
||||
logln()
|
||||
if len(err.Inst) != 0 {
|
||||
logln(err.Inst)
|
||||
}
|
||||
if len(err.Traceback) > 0 {
|
||||
logln("\ntraceback:")
|
||||
for _, line := range err.Traceback {
|
||||
logln(line.Pos.String() + ":")
|
||||
line.Inst.Dump()
|
||||
logln()
|
||||
logln(line.Inst)
|
||||
}
|
||||
}
|
||||
case loader.Errors:
|
||||
|
||||
@@ -10,47 +10,57 @@ import (
|
||||
// Try it easily by opening the following site in Chrome.
|
||||
// https://www.onlinemusictools.com/kb/
|
||||
|
||||
const (
|
||||
cable = 0
|
||||
channel = 1
|
||||
velocity = 0x40
|
||||
)
|
||||
|
||||
func main() {
|
||||
led := machine.LED
|
||||
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
|
||||
|
||||
button := machine.BUTTON
|
||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPulldown})
|
||||
button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
|
||||
|
||||
m := midi.Port()
|
||||
m.SetHandler(func(b []byte) {
|
||||
m.SetRxHandler(func(b []byte) {
|
||||
// blink when we receive a MIDI message
|
||||
led.Set(!led.Get())
|
||||
})
|
||||
|
||||
m.SetTxHandler(func() {
|
||||
// blink when we send a MIDI message
|
||||
led.Set(!led.Get())
|
||||
m.Write(b)
|
||||
})
|
||||
|
||||
prev := true
|
||||
chords := []struct {
|
||||
name string
|
||||
keys []midi.Note
|
||||
name string
|
||||
notes []midi.Note
|
||||
}{
|
||||
{name: "C ", keys: []midi.Note{midi.C4, midi.E4, midi.G4}},
|
||||
{name: "G ", keys: []midi.Note{midi.G3, midi.B3, midi.D4}},
|
||||
{name: "Am", keys: []midi.Note{midi.A3, midi.C4, midi.E4}},
|
||||
{name: "F ", keys: []midi.Note{midi.F3, midi.A3, midi.C4}},
|
||||
{name: "C ", notes: []midi.Note{midi.C4, midi.E4, midi.G4}},
|
||||
{name: "G ", notes: []midi.Note{midi.G3, midi.B3, midi.D4}},
|
||||
{name: "Am", notes: []midi.Note{midi.A3, midi.C4, midi.E4}},
|
||||
{name: "F ", notes: []midi.Note{midi.F3, midi.A3, midi.C4}},
|
||||
}
|
||||
index := 0
|
||||
|
||||
for {
|
||||
current := button.Get()
|
||||
if prev != current {
|
||||
led.Set(current)
|
||||
if current {
|
||||
for _, c := range chords[index].keys {
|
||||
m.NoteOff(0, 0, c, 0x40)
|
||||
for _, note := range chords[index].notes {
|
||||
m.NoteOff(cable, channel, note, velocity)
|
||||
}
|
||||
index = (index + 1) % len(chords)
|
||||
} else {
|
||||
for _, c := range chords[index].keys {
|
||||
m.NoteOn(0, 0, c, 0x40)
|
||||
for _, note := range chords[index].notes {
|
||||
m.NoteOn(cable, channel, note, velocity)
|
||||
}
|
||||
}
|
||||
prev = current
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
//go:build sam && atsamd21 && gemma_m0
|
||||
|
||||
package machine
|
||||
|
||||
// Used to reset into bootloader.
|
||||
const resetMagicValue = 0xf01669ef
|
||||
|
||||
// GPIO Pins.
|
||||
const (
|
||||
D0 = PA04 // SERCOM0/PAD[0]
|
||||
D1 = PA02
|
||||
D2 = PA05 // SERCOM0/PAD[1]
|
||||
D3 = PA00 // DotStar LED: SERCOM1/PAD[0]: APA102/MOSI
|
||||
D4 = PA01 // DotStar LED: SERCOM1/PAD[1]: APA102/SCK
|
||||
D11 = PA30 // Flash Access: SERCOM1/PAD[2]
|
||||
D12 = PA31 // Flash Access: SERCOM1/PAD[3]
|
||||
D13 = PA23 // LED: SERCOM3/PAD[1] SERCOM5/PAD[1]
|
||||
)
|
||||
|
||||
// Analog pins.
|
||||
const (
|
||||
A0 = D1
|
||||
A1 = D2
|
||||
A2 = D0
|
||||
)
|
||||
|
||||
const (
|
||||
LED = PA23
|
||||
)
|
||||
|
||||
// USBCDC pins.
|
||||
const (
|
||||
USBCDC_DM_PIN = PA24
|
||||
USBCDC_DP_PIN = PA25
|
||||
)
|
||||
|
||||
// UART0 pins.
|
||||
const (
|
||||
UART_TX_PIN = PA04 // TX: SERCOM0/PAD[0]
|
||||
UART_RX_PIN = PA05 // RX: SERCOM0/PAD[1]
|
||||
)
|
||||
|
||||
// UART0s on the Gemma M0.
|
||||
var UART0 = &sercomUSART0
|
||||
|
||||
// SPI pins.
|
||||
const (
|
||||
SPI0_SCK_PIN = PA05 // SCK: SERCOM0/PAD[1]
|
||||
SPI0_SDO_PIN = PA04 // MOSI: SERCOM0/PAD[0]
|
||||
SPI0_SDI_PIN = NoPin
|
||||
SPI0_CS_PIN = NoPin
|
||||
)
|
||||
|
||||
// SPI on the Gemma M0.
|
||||
var SPI0 = sercomSPIM0
|
||||
|
||||
// SPI pins for DotStar LED (using APA102 software SPI) and Flash.
|
||||
const (
|
||||
SPI1_SCK_PIN = PA01 // SCK: SERCOM1/PAD[0]
|
||||
SPI1_SDO_PIN = PA00 // MOSI: SERCOM1/PAD[1]
|
||||
SPI1_SDI_PIN = PA31 // MISO: SERCOM1/PAD[3]
|
||||
SPI1_CS_PIN = PA30 // CS: SERCOM1/PAD[2]
|
||||
)
|
||||
|
||||
// I2C pins.
|
||||
const (
|
||||
SDA_PIN = PA04 // SDA: SERCOM0/PAD[0]
|
||||
SCL_PIN = PA05 // SCL: SERCOM0/PAD[1]
|
||||
)
|
||||
|
||||
// I2C on the Gemma M0.
|
||||
var (
|
||||
I2C0 = sercomI2CM0
|
||||
)
|
||||
|
||||
// I2S (not connected, needed for atsamd21).
|
||||
const (
|
||||
I2S_SCK_PIN = NoPin
|
||||
I2S_SD_PIN = NoPin
|
||||
I2S_WS_PIN = NoPin
|
||||
)
|
||||
|
||||
// USB CDC identifiers.
|
||||
const (
|
||||
usb_STRING_PRODUCT = "Adafruit Gemma M0"
|
||||
usb_STRING_MANUFACTURER = "Adafruit"
|
||||
)
|
||||
|
||||
var (
|
||||
usb_VID uint16 = 0x239A
|
||||
usb_PID uint16 = 0x801E
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultUART = UART0
|
||||
)
|
||||
@@ -225,7 +225,23 @@ func initEndpoint(ep, config uint32) {
|
||||
setEPSTATUSCLR(ep, sam.USB_DEVICE_EPSTATUSCLR_BK0RDY)
|
||||
|
||||
case usb.ENDPOINT_TYPE_INTERRUPT | usb.EndpointOut:
|
||||
// TODO: not really anything, seems like...
|
||||
// set packet size
|
||||
usbEndpointDescriptors[ep].DeviceDescBank[0].PCKSIZE.SetBits(epPacketSize(64) << usb_DEVICE_PCKSIZE_SIZE_Pos)
|
||||
|
||||
// set data buffer address
|
||||
usbEndpointDescriptors[ep].DeviceDescBank[0].ADDR.Set(uint32(uintptr(unsafe.Pointer(&udd_ep_out_cache_buffer[ep]))))
|
||||
|
||||
// set endpoint type
|
||||
setEPCFG(ep, ((usb.ENDPOINT_TYPE_INTERRUPT + 1) << sam.USB_DEVICE_EPCFG_EPTYPE0_Pos))
|
||||
|
||||
// receive interrupts when current transfer complete
|
||||
setEPINTENSET(ep, sam.USB_DEVICE_EPINTENSET_TRCPT0)
|
||||
|
||||
// set byte count to zero, we have not received anything yet
|
||||
usbEndpointDescriptors[ep].DeviceDescBank[0].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos)
|
||||
|
||||
// ready for next transfer
|
||||
setEPSTATUSCLR(ep, sam.USB_DEVICE_EPSTATUSCLR_BK0RDY)
|
||||
|
||||
case usb.ENDPOINT_TYPE_BULK | usb.EndpointIn:
|
||||
// set packet size
|
||||
|
||||
@@ -228,7 +228,23 @@ func initEndpoint(ep, config uint32) {
|
||||
setEPSTATUSCLR(ep, sam.USB_DEVICE_ENDPOINT_EPSTATUSCLR_BK0RDY)
|
||||
|
||||
case usb.ENDPOINT_TYPE_INTERRUPT | usb.EndpointOut:
|
||||
// TODO: not really anything, seems like...
|
||||
// set packet size
|
||||
usbEndpointDescriptors[ep].DeviceDescBank[0].PCKSIZE.SetBits(epPacketSize(64) << usb_DEVICE_PCKSIZE_SIZE_Pos)
|
||||
|
||||
// set data buffer address
|
||||
usbEndpointDescriptors[ep].DeviceDescBank[0].ADDR.Set(uint32(uintptr(unsafe.Pointer(&udd_ep_out_cache_buffer[ep]))))
|
||||
|
||||
// set endpoint type
|
||||
setEPCFG(ep, ((usb.ENDPOINT_TYPE_INTERRUPT + 1) << sam.USB_DEVICE_ENDPOINT_EPCFG_EPTYPE0_Pos))
|
||||
|
||||
// receive interrupts when current transfer complete
|
||||
setEPINTENSET(ep, sam.USB_DEVICE_ENDPOINT_EPINTENSET_TRCPT0)
|
||||
|
||||
// set byte count to zero, we have not received anything yet
|
||||
usbEndpointDescriptors[ep].DeviceDescBank[0].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos)
|
||||
|
||||
// ready for next transfer
|
||||
setEPSTATUSCLR(ep, sam.USB_DEVICE_ENDPOINT_EPSTATUSCLR_BK0RDY)
|
||||
|
||||
case usb.ENDPOINT_TYPE_BULK | usb.EndpointIn:
|
||||
// set packet size
|
||||
|
||||
@@ -8,21 +8,21 @@ import (
|
||||
)
|
||||
|
||||
// https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/rp2040_usb_device_enumeration.c
|
||||
// According to errata RP2040-E5:
|
||||
// "It is safe (and inexpensive) to enable the software workaround even when using versions of RP2040
|
||||
// which include the fix in hardware."
|
||||
// So let us always use the software fix.
|
||||
func fixRP2040UsbDeviceEnumeration() {
|
||||
// After coming out of reset, the hardware expects 800us of LS_J (linestate J) time
|
||||
// before it will move to the connected state. However on a hub that broadcasts packets
|
||||
// for other devices this isn't the case. The plan here is to wait for the end of the bus
|
||||
// reset, force an LS_J for 1ms and then switch control back to the USB phy. Unfortunately
|
||||
// this requires us to use GPIO15 as there is no other way to force the input path.
|
||||
// We only need to force DP as DM can be left at zero. It will be gated off by GPIO
|
||||
// logic if it isn't func selected.
|
||||
|
||||
// Actually check for B0/B1 h/w
|
||||
if ChipVersion() == 1 {
|
||||
// After coming out of reset, the hardware expects 800us of LS_J (linestate J) time
|
||||
// before it will move to the connected state. However on a hub that broadcasts packets
|
||||
// for other devices this isn't the case. The plan here is to wait for the end of the bus
|
||||
// reset, force an LS_J for 1ms and then switch control back to the USB phy. Unfortunately
|
||||
// this requires us to use GPIO15 as there is no other way to force the input path.
|
||||
// We only need to force DP as DM can be left at zero. It will be gated off by GPIO
|
||||
// logic if it isn't func selected.
|
||||
|
||||
// Wait SE0 phase will call force ls_j phase which will call finish phase
|
||||
hw_enumeration_fix_wait_se0()
|
||||
}
|
||||
// Wait SE0 phase will call force ls_j phase which will call finish phase
|
||||
hw_enumeration_fix_wait_se0()
|
||||
}
|
||||
|
||||
func hw_enumeration_fix_wait_se0() {
|
||||
@@ -87,8 +87,8 @@ func hw_enumeration_fix_force_ls_j() {
|
||||
// Switch to GPIO phy with LS_J forced
|
||||
rp.USBCTRL_REGS.USB_MUXING.Set(rp.USBCTRL_REGS_USB_MUXING_TO_DIGITAL_PAD | rp.USBCTRL_REGS_USB_MUXING_SOFTCON)
|
||||
|
||||
// LS_J is now forced but while loop here just to check
|
||||
waitCycles(125000)
|
||||
// LS_J is now forced but while loop to wait ~800us here just to check
|
||||
waitCycles(25000)
|
||||
|
||||
// if timer pool disabled, or no timer available, have to busy wait.
|
||||
hw_enumeration_fix_finish()
|
||||
|
||||
@@ -1,19 +1,233 @@
|
||||
package midi
|
||||
|
||||
// NoteOn sends a note on message.
|
||||
func (m *midi) NoteOn(cable, channel uint8, note Note, velocity uint8) {
|
||||
m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|0x9, 0x90|(channel&0xf), byte(note)&0x7f, velocity&0x7f
|
||||
m.Write(m.msg[:])
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// From USB-MIDI section 4.1 "Code Index Number (CIN) Classifications"
|
||||
const (
|
||||
CINSystemCommon2 = 0x2
|
||||
CINSystemCommon3 = 0x3
|
||||
CINSysExStart = 0x4
|
||||
CINSysExEnd1 = 0x5
|
||||
CINSysExEnd2 = 0x6
|
||||
CINSysExEnd3 = 0x7
|
||||
CINNoteOff = 0x8
|
||||
CINNoteOn = 0x9
|
||||
CINPoly = 0xA
|
||||
CINControlChange = 0xB
|
||||
CINProgramChange = 0xC
|
||||
CINChannelPressure = 0xD
|
||||
CINPitchBendChange = 0xE
|
||||
CINSingleByte = 0xF
|
||||
)
|
||||
|
||||
// Standard MIDI channel messages
|
||||
const (
|
||||
MsgNoteOff = 0x80
|
||||
MsgNoteOn = 0x90
|
||||
MsgPolyAftertouch = 0xA0
|
||||
MsgControlChange = 0xB0
|
||||
MsgProgramChange = 0xC0
|
||||
MsgChannelAftertouch = 0xD0
|
||||
MsgPitchBend = 0xE0
|
||||
MsgSysExStart = 0xF0
|
||||
MsgSysExEnd = 0xF7
|
||||
)
|
||||
|
||||
// Standard MIDI control change messages
|
||||
const (
|
||||
CCModulationWheel = 0x01
|
||||
CCBreathController = 0x02
|
||||
CCFootPedal = 0x04
|
||||
CCPortamentoTime = 0x05
|
||||
CCDataEntry = 0x06
|
||||
CCVolume = 0x07
|
||||
CCBalance = 0x08
|
||||
CCPan = 0x0A
|
||||
CCExpression = 0x0B
|
||||
CCEffectControl1 = 0x0C
|
||||
CCEffectControl2 = 0x0D
|
||||
CCGeneralPurpose1 = 0x10
|
||||
CCGeneralPurpose2 = 0x11
|
||||
CCGeneralPurpose3 = 0x12
|
||||
CCGeneralPurpose4 = 0x13
|
||||
CCBankSelect = 0x20
|
||||
CCModulationDepthRange = 0x21
|
||||
CCBreathControllerDepth = 0x22
|
||||
CCFootPedalDepth = 0x24
|
||||
CCEffectsLevel = 0x5B
|
||||
CCTremeloLevel = 0x5C
|
||||
CCChorusLevel = 0x5D
|
||||
CCCelesteLevel = 0x5E
|
||||
CCPhaserLevel = 0x5F
|
||||
CCDataIncrement = 0x60
|
||||
CCDataDecrement = 0x61
|
||||
CCNRPNLSB = 0x62
|
||||
CCNRPNMSB = 0x63
|
||||
CCRPNLSB = 0x64
|
||||
CCRPNMSB = 0x65
|
||||
CCAllSoundOff = 0x78
|
||||
CCResetAllControllers = 0x79
|
||||
CCAllNotesOff = 0x7B
|
||||
CCChannelVolume = 0x7F
|
||||
)
|
||||
|
||||
var (
|
||||
errInvalidMIDICable = errors.New("invalid MIDI cable")
|
||||
errInvalidMIDIChannel = errors.New("invalid MIDI channel")
|
||||
errInvalidMIDIVelocity = errors.New("invalid MIDI velocity")
|
||||
errInvalidMIDIControl = errors.New("invalid MIDI control number")
|
||||
errInvalidMIDIControlValue = errors.New("invalid MIDI control value")
|
||||
errInvalidMIDIPatch = errors.New("invalid MIDI patch number")
|
||||
errInvalidMIDIPitchBend = errors.New("invalid MIDI pitch bend value")
|
||||
errInvalidMIDISysExData = errors.New("invalid MIDI SysEx data")
|
||||
)
|
||||
|
||||
// NoteOn sends a channel note on message.
|
||||
// The cable parameter is the cable number 0-15.
|
||||
// The channel parameter is the MIDI channel number 1-16.
|
||||
func (m *midi) NoteOn(cable, channel uint8, note Note, velocity uint8) error {
|
||||
switch {
|
||||
case cable > 15:
|
||||
return errInvalidMIDICable
|
||||
case channel == 0 || channel > 16:
|
||||
return errInvalidMIDIChannel
|
||||
case velocity > 127:
|
||||
return errInvalidMIDIVelocity
|
||||
}
|
||||
|
||||
m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINNoteOn, MsgNoteOn|(channel-1&0xf), byte(note)&0x7f, velocity&0x7f
|
||||
_, err := m.Write(m.msg[:])
|
||||
return err
|
||||
}
|
||||
|
||||
// NoteOff sends a note off message.
|
||||
func (m *midi) NoteOff(cable, channel uint8, note Note, velocity uint8) {
|
||||
m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|0x8, 0x80|(channel&0xf), byte(note)&0x7f, velocity&0x7f
|
||||
m.Write(m.msg[:])
|
||||
// NoteOff sends a channel note off message.
|
||||
// The cable parameter is the cable number 0-15.
|
||||
// The channel parameter is the MIDI channel number 1-16.
|
||||
func (m *midi) NoteOff(cable, channel uint8, note Note, velocity uint8) error {
|
||||
switch {
|
||||
case cable > 15:
|
||||
return errInvalidMIDICable
|
||||
case channel == 0 || channel > 16:
|
||||
return errInvalidMIDIChannel
|
||||
case velocity > 127:
|
||||
return errInvalidMIDIVelocity
|
||||
}
|
||||
|
||||
m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINNoteOff, MsgNoteOff|(channel-1&0xf), byte(note)&0x7f, velocity&0x7f
|
||||
_, err := m.Write(m.msg[:])
|
||||
return err
|
||||
}
|
||||
|
||||
// SendCC sends a continuous controller message.
|
||||
func (m *midi) SendCC(cable, channel, control, value uint8) {
|
||||
m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|0xB, 0xB0|(channel&0xf), control&0x7f, value&0x7f
|
||||
m.Write(m.msg[:])
|
||||
// ControlChange sends a channel continuous controller message.
|
||||
// The cable parameter is the cable number 0-15.
|
||||
// The channel parameter is the MIDI channel number 1-16.
|
||||
// The control parameter is the controller number 0-127.
|
||||
// The value parameter is the controller value 0-127.
|
||||
func (m *midi) ControlChange(cable, channel, control, value uint8) error {
|
||||
switch {
|
||||
case cable > 15:
|
||||
return errInvalidMIDICable
|
||||
case channel == 0 || channel > 16:
|
||||
return errInvalidMIDIChannel
|
||||
case control > 127:
|
||||
return errInvalidMIDIControl
|
||||
case value > 127:
|
||||
return errInvalidMIDIControlValue
|
||||
}
|
||||
|
||||
m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINControlChange, MsgControlChange|(channel-1&0xf), control&0x7f, value&0x7f
|
||||
_, err := m.Write(m.msg[:])
|
||||
return err
|
||||
}
|
||||
|
||||
// ProgramChange sends a channel program change message.
|
||||
// The cable parameter is the cable number 0-15.
|
||||
// The channel parameter is the MIDI channel number 1-16.
|
||||
// The patch parameter is the program number 0-127.
|
||||
func (m *midi) ProgramChange(cable, channel uint8, patch uint8) error {
|
||||
switch {
|
||||
case cable > 15:
|
||||
return errInvalidMIDICable
|
||||
case channel == 0 || channel > 16:
|
||||
return errInvalidMIDIChannel
|
||||
case patch > 127:
|
||||
return errInvalidMIDIPatch
|
||||
}
|
||||
|
||||
m.msg[0], m.msg[1], m.msg[2] = (cable&0xf<<4)|CINProgramChange, MsgProgramChange|(channel-1&0xf), patch&0x7f
|
||||
_, err := m.Write(m.msg[:3])
|
||||
return err
|
||||
}
|
||||
|
||||
// PitchBend sends a channel pitch bend message.
|
||||
// The cable parameter is the cable number 0-15.
|
||||
// The channel parameter is the MIDI channel number 1-16.
|
||||
// The bend parameter is the 14-bit pitch bend value (maximum 0x3FFF).
|
||||
// Setting bend above 0x2000 (up to 0x3FFF) will increase the pitch.
|
||||
// Setting bend below 0x2000 (down to 0x0000) will decrease the pitch.
|
||||
func (m *midi) PitchBend(cable, channel uint8, bend uint16) error {
|
||||
switch {
|
||||
case cable > 15:
|
||||
return errInvalidMIDICable
|
||||
case channel == 0 || channel > 16:
|
||||
return errInvalidMIDIChannel
|
||||
case bend > 0x3FFF:
|
||||
return errInvalidMIDIPitchBend
|
||||
}
|
||||
|
||||
m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINPitchBendChange, MsgPitchBend|(channel-1&0xf), byte(bend&0x7f), byte(bend>>8)&0x7f
|
||||
_, err := m.Write(m.msg[:])
|
||||
return err
|
||||
}
|
||||
|
||||
// SysEx sends a System Exclusive message.
|
||||
// The cable parameter is the cable number 0-15.
|
||||
// The data parameter is a slice with the data to send.
|
||||
// It needs to start with the manufacturer ID, which is either
|
||||
// 1 or 3 bytes in length.
|
||||
// The data slice should not include the SysEx start (0xF0) or
|
||||
// end (0xF7) bytes, only the data in between.
|
||||
func (m *midi) SysEx(cable uint8, data []byte) error {
|
||||
switch {
|
||||
case cable > 15:
|
||||
return errInvalidMIDICable
|
||||
case len(data) < 3:
|
||||
return errInvalidMIDISysExData
|
||||
}
|
||||
|
||||
// write start
|
||||
m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExStart, MsgSysExStart
|
||||
m.msg[2], m.msg[3] = data[0], data[1]
|
||||
if _, err := m.Write(m.msg[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// write middle
|
||||
i := 2
|
||||
for ; i < len(data)-2; i += 3 {
|
||||
m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExStart, data[i]
|
||||
m.msg[2], m.msg[3] = data[i+1], data[i+2]
|
||||
if _, err := m.Write(m.msg[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// write end
|
||||
switch len(data) - i {
|
||||
case 2:
|
||||
m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExEnd3, data[i]
|
||||
m.msg[2], m.msg[3] = data[i+1], MsgSysExEnd
|
||||
case 1:
|
||||
m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExEnd2, data[i]
|
||||
m.msg[2], m.msg[3] = MsgSysExEnd, 0
|
||||
case 0:
|
||||
m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExEnd1, MsgSysExEnd
|
||||
m.msg[2], m.msg[3] = 0, 0
|
||||
}
|
||||
if _, err := m.Write(m.msg[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ type midi struct {
|
||||
msg [4]byte
|
||||
buf *RingBuffer
|
||||
rxHandler func([]byte)
|
||||
txHandler func()
|
||||
waitTxc bool
|
||||
}
|
||||
|
||||
@@ -53,7 +54,7 @@ func newMidi() *midi {
|
||||
Index: usb.MIDI_ENDPOINT_IN,
|
||||
IsIn: true,
|
||||
Type: usb.ENDPOINT_TYPE_BULK,
|
||||
TxHandler: m.Handler,
|
||||
TxHandler: m.TxHandler,
|
||||
},
|
||||
},
|
||||
[]usb.SetupConfig{},
|
||||
@@ -61,16 +62,32 @@ func newMidi() *midi {
|
||||
return m
|
||||
}
|
||||
|
||||
// SetHandler is now deprecated, please use SetRxHandler().
|
||||
func (m *midi) SetHandler(rxHandler func([]byte)) {
|
||||
m.SetRxHandler(rxHandler)
|
||||
}
|
||||
|
||||
// SetRxHandler sets the handler function for incoming MIDI messages.
|
||||
func (m *midi) SetRxHandler(rxHandler func([]byte)) {
|
||||
m.rxHandler = rxHandler
|
||||
}
|
||||
|
||||
// SetTxHandler sets the handler function for outgoing MIDI messages.
|
||||
func (m *midi) SetTxHandler(txHandler func()) {
|
||||
m.txHandler = txHandler
|
||||
}
|
||||
|
||||
func (m *midi) Write(b []byte) (n int, err error) {
|
||||
i := 0
|
||||
for i = 0; i < len(b); i += 4 {
|
||||
m.tx(b[i : i+4])
|
||||
s, e := 0, 0
|
||||
for s = 0; s < len(b); s += 4 {
|
||||
e = s + 4
|
||||
if e > len(b) {
|
||||
e = len(b)
|
||||
}
|
||||
|
||||
m.tx(b[s:e])
|
||||
}
|
||||
return i, nil
|
||||
return e, nil
|
||||
}
|
||||
|
||||
// sendUSBPacket sends a MIDIPacket.
|
||||
@@ -79,7 +96,11 @@ func (m *midi) sendUSBPacket(b []byte) {
|
||||
}
|
||||
|
||||
// from BulkIn
|
||||
func (m *midi) Handler() {
|
||||
func (m *midi) TxHandler() {
|
||||
if m.txHandler != nil {
|
||||
m.txHandler()
|
||||
}
|
||||
|
||||
m.waitTxc = false
|
||||
if b, ok := m.buf.Get(); ok {
|
||||
m.waitTxc = true
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
// ptrTo *typeStruct
|
||||
// elem *typeStruct // element type of the array
|
||||
// arrayLen uintptr // length of the array (this is part of the type)
|
||||
// slicePtr *typeStruct // pointer to []T type
|
||||
// - map types (this is still missing the key and element types)
|
||||
// meta uint8
|
||||
// nmethods uint16 (0)
|
||||
@@ -427,6 +428,7 @@ type arrayType struct {
|
||||
ptrTo *rawType
|
||||
elem *rawType
|
||||
arrayLen uintptr
|
||||
slicePtr *rawType
|
||||
}
|
||||
|
||||
type mapType struct {
|
||||
|
||||
+39
-4
@@ -555,8 +555,26 @@ func (v Value) Slice(i, j int) Value {
|
||||
}
|
||||
|
||||
case Array:
|
||||
// TODO(dgryski): can't do this yet because the resulting value needs type slice of v.elem(), not array of v.elem().
|
||||
// need to be able to look up this "new" type so pointer equality of types still works
|
||||
v.checkAddressable()
|
||||
buf, length := buflen(v)
|
||||
i, j := uintptr(i), uintptr(j)
|
||||
if j < i || length < j {
|
||||
slicePanic()
|
||||
}
|
||||
|
||||
elemSize := v.typecode.underlying().elem().Size()
|
||||
|
||||
var hdr sliceHeader
|
||||
hdr.len = j - i
|
||||
hdr.cap = length - i
|
||||
hdr.data = unsafe.Add(buf, i*elemSize)
|
||||
|
||||
sliceType := (*arrayType)(unsafe.Pointer(v.typecode.underlying())).slicePtr
|
||||
return Value{
|
||||
typecode: sliceType,
|
||||
value: unsafe.Pointer(&hdr),
|
||||
flags: v.flags,
|
||||
}
|
||||
|
||||
case String:
|
||||
i, j := uintptr(i), uintptr(j)
|
||||
@@ -604,9 +622,26 @@ func (v Value) Slice3(i, j, k int) Value {
|
||||
}
|
||||
|
||||
case Array:
|
||||
// TODO(dgryski): can't do this yet because the resulting value needs type v.elem(), not array of v.elem().
|
||||
// need to be able to look up this "new" type so pointer equality of types still works
|
||||
v.checkAddressable()
|
||||
buf, length := buflen(v)
|
||||
i, j, k := uintptr(i), uintptr(j), uintptr(k)
|
||||
if j < i || k < j || length < k {
|
||||
slicePanic()
|
||||
}
|
||||
|
||||
elemSize := v.typecode.underlying().elem().Size()
|
||||
|
||||
var hdr sliceHeader
|
||||
hdr.len = j - i
|
||||
hdr.cap = k - i
|
||||
hdr.data = unsafe.Add(buf, i*elemSize)
|
||||
|
||||
sliceType := (*arrayType)(unsafe.Pointer(v.typecode.underlying())).slicePtr
|
||||
return Value{
|
||||
typecode: sliceType,
|
||||
value: unsafe.Pointer(&hdr),
|
||||
flags: v.flags,
|
||||
}
|
||||
}
|
||||
|
||||
panic("unimplemented: (reflect.Value).Slice3()")
|
||||
|
||||
@@ -420,7 +420,7 @@ func runGC() (freeBytes uintptr) {
|
||||
|
||||
// Mark phase: mark all reachable objects, recursively.
|
||||
markStack()
|
||||
markGlobals()
|
||||
findGlobals(markRoots)
|
||||
|
||||
if baremetal && hasScheduler {
|
||||
// Channel operations in interrupts may move task pointers around while we are marking.
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
package runtime
|
||||
|
||||
// This file implements markGlobals for all the files that don't have a more
|
||||
// specific implementation.
|
||||
// This file implements findGlobals for all systems where the start and end of
|
||||
// the globals section can be found through linker-defined symbols.
|
||||
|
||||
// markGlobals marks all globals, which are reachable by definition.
|
||||
// findGlobals finds all globals (which are reachable by definition) and calls
|
||||
// the callback for them.
|
||||
//
|
||||
// This implementation marks all globals conservatively and assumes it can use
|
||||
// linker-defined symbols for the start and end of the .data section.
|
||||
func markGlobals() {
|
||||
markRoots(globalsStart, globalsEnd)
|
||||
func findGlobals(found func(start, end uintptr)) {
|
||||
found(globalsStart, globalsEnd)
|
||||
}
|
||||
|
||||
@@ -100,7 +100,3 @@ func setHeapEnd(newHeapEnd uintptr) {
|
||||
// enough.
|
||||
heapEnd = newHeapEnd
|
||||
}
|
||||
|
||||
func markRoots(start, end uintptr) {
|
||||
// dummy, so that markGlobals will compile
|
||||
}
|
||||
|
||||
@@ -37,7 +37,3 @@ func initHeap() {
|
||||
func setHeapEnd(newHeapEnd uintptr) {
|
||||
// Nothing to do here, this function is never actually called.
|
||||
}
|
||||
|
||||
func markRoots(start, end uintptr) {
|
||||
// dummy, so that markGlobals will compile
|
||||
}
|
||||
|
||||
@@ -54,12 +54,12 @@ type segmentLoadCommand struct {
|
||||
//go:extern _mh_execute_header
|
||||
var libc_mh_execute_header machHeader
|
||||
|
||||
// Mark global variables.
|
||||
// Find global variables in .data/.bss sections.
|
||||
// The MachO linker doesn't seem to provide symbols for the start and end of the
|
||||
// data section. There is get_etext, get_edata, and get_end, but these are
|
||||
// undocumented and don't work with ASLR (which is enabled by default).
|
||||
// Therefore, read the MachO header directly.
|
||||
func markGlobals() {
|
||||
func findGlobals(found func(start, end uintptr)) {
|
||||
// Here is a useful blog post to understand the MachO file format:
|
||||
// https://h3adsh0tzz.com/2020/01/macho-file-format/
|
||||
|
||||
@@ -103,7 +103,7 @@ func markGlobals() {
|
||||
// This could be improved by only reading the memory areas
|
||||
// covered by sections. That would reduce the amount of memory
|
||||
// scanned a little bit (up to a single VM page).
|
||||
markRoots(offset+cmd.vmaddr, offset+cmd.vmaddr+cmd.vmsize)
|
||||
found(offset+cmd.vmaddr, offset+cmd.vmaddr+cmd.vmsize)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ type elfProgramHeader32 struct {
|
||||
//go:extern __ehdr_start
|
||||
var ehdr_start elfHeader
|
||||
|
||||
// markGlobals marks all globals, which are reachable by definition.
|
||||
// findGlobals finds globals in the .data/.bss sections.
|
||||
// It parses the ELF program header to find writable segments.
|
||||
func markGlobals() {
|
||||
func findGlobals(found func(start, end uintptr)) {
|
||||
// Relevant constants from the ELF specification.
|
||||
// See: https://refspecs.linuxfoundation.org/elf/elf.pdf
|
||||
const (
|
||||
@@ -99,14 +99,14 @@ func markGlobals() {
|
||||
if header._type == PT_LOAD && header.flags&PF_W != 0 {
|
||||
start := header.vaddr
|
||||
end := start + header.memsz
|
||||
markRoots(start, end)
|
||||
found(start, end)
|
||||
}
|
||||
} else {
|
||||
header := (*elfProgramHeader32)(headerPtr)
|
||||
if header._type == PT_LOAD && header.flags&PF_W != 0 {
|
||||
start := header.vaddr
|
||||
end := start + header.memsz
|
||||
markRoots(start, end)
|
||||
found(start, end)
|
||||
}
|
||||
}
|
||||
headerPtr = unsafe.Add(headerPtr, ehdr_start.phentsize)
|
||||
|
||||
@@ -52,7 +52,7 @@ var module *exeHeader
|
||||
// around 160 bytes of amd64 instructions.
|
||||
// Most of this function is based on the documentation in
|
||||
// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format.
|
||||
func markGlobals() {
|
||||
func findGlobals(found func(start, end uintptr)) {
|
||||
// Constants used in this function.
|
||||
const (
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulehandleexa
|
||||
@@ -85,7 +85,7 @@ func markGlobals() {
|
||||
// Found a writable section. Scan the entire section for roots.
|
||||
start := uintptr(unsafe.Pointer(module)) + uintptr(section.virtualAddress)
|
||||
end := uintptr(unsafe.Pointer(module)) + uintptr(section.virtualAddress) + uintptr(section.virtualSize)
|
||||
markRoots(start, end)
|
||||
found(start, end)
|
||||
}
|
||||
section = (*peSection)(unsafe.Add(unsafe.Pointer(section), unsafe.Sizeof(peSection{})))
|
||||
}
|
||||
|
||||
@@ -245,17 +245,17 @@ var bssStartSymbol [0]byte
|
||||
//go:extern __bss_end
|
||||
var bssEndSymbol [0]byte
|
||||
|
||||
// Mark global variables.
|
||||
// Find global variables.
|
||||
// The linker script provides __*_start and __*_end symbols that can be used to
|
||||
// scan the given sections. They are already aligned so don't need to be
|
||||
// manually aligned here.
|
||||
func markGlobals() {
|
||||
func findGlobals(found func(start, end uintptr)) {
|
||||
dataStart := uintptr(unsafe.Pointer(&dataStartSymbol))
|
||||
dataEnd := uintptr(unsafe.Pointer(&dataEndSymbol))
|
||||
markRoots(dataStart, dataEnd)
|
||||
found(dataStart, dataEnd)
|
||||
bssStart := uintptr(unsafe.Pointer(&bssStartSymbol))
|
||||
bssEnd := uintptr(unsafe.Pointer(&bssEndSymbol))
|
||||
markRoots(bssStart, bssEnd)
|
||||
found(bssStart, bssEnd)
|
||||
}
|
||||
|
||||
// getContextPtr returns the hblauncher context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"inherits": ["riscv32"],
|
||||
"features": "+c,+m,-relax,-save-restore",
|
||||
"features": "+32bit,+c,+m,-64bit,-a,-d,-e,-experimental-zawrs,-experimental-zca,-experimental-zcd,-experimental-zcf,-experimental-zihintntl,-experimental-ztso,-experimental-zvfh,-f,-h,-relax,-save-restore,-svinval,-svnapot,-svpbmt,-v,-xtheadvdot,-xventanacondops,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zdinx,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zicbom,-zicbop,-zicboz,-zihintpause,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-zmmul,-zve32f,-zve32x,-zve64d,-zve64f,-zve64x,-zvl1024b,-zvl128b,-zvl16384b,-zvl2048b,-zvl256b,-zvl32768b,-zvl32b,-zvl4096b,-zvl512b,-zvl64b,-zvl65536b,-zvl8192b",
|
||||
"build-tags": ["esp32c3", "esp"],
|
||||
"serial": "uart",
|
||||
"rtlib": "compiler-rt",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"inherits": ["riscv32"],
|
||||
"cpu": "sifive-e31",
|
||||
"features": "+a,+c,+m,-64bit,-relax,-save-restore",
|
||||
"features": "+32bit,+a,+c,+m,-64bit,-d,-e,-experimental-zawrs,-experimental-zca,-experimental-zcd,-experimental-zcf,-experimental-zihintntl,-experimental-ztso,-experimental-zvfh,-f,-h,-relax,-save-restore,-svinval,-svnapot,-svpbmt,-v,-xtheadvdot,-xventanacondops,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zdinx,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zicbom,-zicbop,-zicboz,-zihintpause,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-zmmul,-zve32f,-zve32x,-zve64d,-zve64f,-zve64x,-zvl1024b,-zvl128b,-zvl16384b,-zvl2048b,-zvl256b,-zvl32768b,-zvl32b,-zvl4096b,-zvl512b,-zvl64b,-zvl65536b,-zvl8192b",
|
||||
"build-tags": ["fe310", "sifive"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"inherits": ["atsamd21e18a"],
|
||||
"build-tags": ["gemma_m0"],
|
||||
"serial": "usb",
|
||||
"serial-port": ["239a:801e"],
|
||||
"flash-1200-bps-reset": "true",
|
||||
"flash-method": "msd",
|
||||
"msd-volume-name": ["GEMMABOOT"],
|
||||
"msd-firmware-name": "firmware.uf2"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"inherits": ["pybadge"]
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"inherits": ["riscv64"],
|
||||
"features": "+64bit,+a,+c,+d,+f,+m,-relax,-save-restore",
|
||||
"features": "+64bit,+a,+c,+d,+f,+m,-e,-experimental-zawrs,-experimental-zca,-experimental-zcd,-experimental-zcf,-experimental-zihintntl,-experimental-ztso,-experimental-zvfh,-h,-relax,-save-restore,-svinval,-svnapot,-svpbmt,-v,-xtheadvdot,-xventanacondops,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zdinx,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zicbom,-zicbop,-zicboz,-zihintpause,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-zmmul,-zve32f,-zve32x,-zve64d,-zve64f,-zve64x,-zvl1024b,-zvl128b,-zvl16384b,-zvl2048b,-zvl256b,-zvl32768b,-zvl32b,-zvl4096b,-zvl512b,-zvl64b,-zvl65536b,-zvl8192b",
|
||||
"build-tags": ["k210", "kendryte"],
|
||||
"code-model": "medium"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"llvm-target": "aarch64",
|
||||
"cpu": "cortex-a57",
|
||||
"features": "+aes,+crc,+crypto,+fp-armv8,+neon,+sha2,+v8a",
|
||||
"features": "+aes,+crc,+crypto,+fp-armv8,+neon,+sha2,+v8a,-fmv",
|
||||
"build-tags": ["nintendoswitch", "arm64"],
|
||||
"scheduler": "tasks",
|
||||
"goos": "linux",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"inherits": ["riscv32"],
|
||||
"features": "+a,+c,+m,-relax,-save-restore",
|
||||
"features": "+32bit,+a,+c,+m,-64bit,-d,-e,-experimental-zawrs,-experimental-zca,-experimental-zcd,-experimental-zcf,-experimental-zihintntl,-experimental-ztso,-experimental-zvfh,-f,-h,-relax,-save-restore,-svinval,-svnapot,-svpbmt,-v,-xtheadvdot,-xventanacondops,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zdinx,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zicbom,-zicbop,-zicboz,-zihintpause,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-zmmul,-zve32f,-zve32x,-zve64d,-zve64f,-zve64x,-zvl1024b,-zvl128b,-zvl16384b,-zvl2048b,-zvl256b,-zvl32768b,-zvl32b,-zvl4096b,-zvl512b,-zvl64b,-zvl65536b,-zvl8192b",
|
||||
"build-tags": ["virt", "qemu"],
|
||||
"default-stack-size": 4096,
|
||||
"linkerscript": "targets/riscv-qemu.ld",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"inherits": ["riscv"],
|
||||
"llvm-target": "riscv32-unknown-none",
|
||||
"cpu": "generic-rv32",
|
||||
"target-abi": "ilp32",
|
||||
"build-tags": ["tinygo.riscv32"],
|
||||
"scheduler": "tasks",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"inherits": ["riscv"],
|
||||
"llvm-target": "riscv64-unknown-none",
|
||||
"cpu": "generic-rv64",
|
||||
"target-abi": "lp64",
|
||||
"build-tags": ["tinygo.riscv64"],
|
||||
"cflags": [
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"llvm-target": "wasm32-unknown-wasi",
|
||||
"cpu": "generic",
|
||||
"features": "+bulk-memory,+nontrapping-fptoint,+sign-ext",
|
||||
"features": "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext",
|
||||
"build-tags": ["tinygo.wasm", "wasi"],
|
||||
"goos": "linux",
|
||||
"goarch": "arm",
|
||||
@@ -9,7 +9,7 @@
|
||||
"libc": "wasi-libc",
|
||||
"rtlib": "compiler-rt",
|
||||
"scheduler": "asyncify",
|
||||
"default-stack-size": 16384,
|
||||
"default-stack-size": 32768,
|
||||
"cflags": [
|
||||
"-mbulk-memory",
|
||||
"-mnontrapping-fptoint",
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"llvm-target": "wasm32-unknown-wasi",
|
||||
"cpu": "generic",
|
||||
"features": "+bulk-memory,+nontrapping-fptoint,+sign-ext",
|
||||
"features": "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext",
|
||||
"build-tags": ["tinygo.wasm"],
|
||||
"goos": "js",
|
||||
"goarch": "wasm",
|
||||
@@ -9,7 +9,7 @@
|
||||
"libc": "wasi-libc",
|
||||
"rtlib": "compiler-rt",
|
||||
"scheduler": "asyncify",
|
||||
"default-stack-size": 16384,
|
||||
"default-stack-size": 32768,
|
||||
"cflags": [
|
||||
"-mbulk-memory",
|
||||
"-mnontrapping-fptoint",
|
||||
|
||||
Vendored
-4
@@ -52,10 +52,6 @@ func main() {
|
||||
println("static headerfunc:", C.headerfunc_static(5))
|
||||
headerfunc_2()
|
||||
|
||||
// equivalent types
|
||||
var goInt8 int8 = 5
|
||||
var _ C.int8_t = goInt8
|
||||
|
||||
// more globals
|
||||
println("bool:", C.globalBool, C.globalBool2 == true)
|
||||
println("float:", C.globalFloat)
|
||||
|
||||
Reference in New Issue
Block a user