Compare commits
No commits in common. "f1581299fcca037eae5522d51cbdc6557bce5397" and "2a922c74800d1da934f722a61aa3af4ff783ea05" have entirely different histories.
f1581299fc
...
2a922c7480
@ -552,9 +552,9 @@ pub fn call_j0<'ctx>(
|
||||
///
|
||||
/// * `num_dims` - An [IntValue] containing the number of dimensions.
|
||||
/// * `dims` - A [PointerValue] to an array containing the size of each dimensions.
|
||||
pub fn call_ndarray_calc_size<'ctx>(
|
||||
generator: &dyn CodeGenerator,
|
||||
ctx: &mut CodeGenContext<'ctx, '_>,
|
||||
pub fn call_ndarray_calc_size<'ctx, 'a>(
|
||||
generator: &mut dyn CodeGenerator,
|
||||
ctx: &mut CodeGenContext<'ctx, 'a>,
|
||||
num_dims: IntValue<'ctx>,
|
||||
dims: PointerValue<'ctx>,
|
||||
) -> IntValue<'ctx> {
|
||||
@ -563,7 +563,7 @@ pub fn call_ndarray_calc_size<'ctx>(
|
||||
|
||||
let llvm_pi64 = llvm_i64.ptr_type(AddressSpace::default());
|
||||
|
||||
let ndarray_calc_size_fn_name = match llvm_usize.get_bit_width() {
|
||||
let ndarray_calc_size_fn_name = match generator.get_size_type(ctx.ctx).get_bit_width() {
|
||||
32 => "__nac3_ndarray_calc_size",
|
||||
64 => "__nac3_ndarray_calc_size64",
|
||||
bw => unreachable!("Unsupported size type bit width: {}", bw)
|
||||
@ -600,9 +600,9 @@ pub fn call_ndarray_calc_size<'ctx>(
|
||||
/// `NDArray`.
|
||||
/// * `shape` - LLVM pointer to the `shape` of the NDArray. This value must be the LLVM
|
||||
/// representation of a `list`.
|
||||
pub fn call_ndarray_init_dims<'ctx>(
|
||||
generator: &dyn CodeGenerator,
|
||||
ctx: &mut CodeGenContext<'ctx, '_>,
|
||||
pub fn call_ndarray_init_dims<'ctx, 'a>(
|
||||
generator: &mut dyn CodeGenerator,
|
||||
ctx: &mut CodeGenContext<'ctx, 'a>,
|
||||
ndarray: PointerValue<'ctx>,
|
||||
shape: PointerValue<'ctx>,
|
||||
) {
|
||||
@ -616,7 +616,7 @@ pub fn call_ndarray_init_dims<'ctx>(
|
||||
let llvm_pi32 = llvm_i32.ptr_type(AddressSpace::default());
|
||||
let llvm_pusize = llvm_usize.ptr_type(AddressSpace::default());
|
||||
|
||||
let ndarray_init_dims_fn_name = match llvm_usize.get_bit_width() {
|
||||
let ndarray_init_dims_fn_name = match generator.get_size_type(ctx.ctx).get_bit_width() {
|
||||
32 => "__nac3_ndarray_init_dims",
|
||||
64 => "__nac3_ndarray_init_dims64",
|
||||
bw => unreachable!("Unsupported size type bit width: {}", bw)
|
||||
@ -661,14 +661,9 @@ pub fn call_ndarray_init_dims<'ctx>(
|
||||
);
|
||||
}
|
||||
|
||||
/// Generates a call to `__nac3_ndarray_calc_nd_indices`.
|
||||
///
|
||||
/// * `index` - The index to compute the multidimensional index for.
|
||||
/// * `ndarray` - LLVM pointer to the NDArray. This value must be the LLVM representation of an
|
||||
/// `NDArray`.
|
||||
pub fn call_ndarray_calc_nd_indices<'ctx>(
|
||||
generator: &dyn CodeGenerator,
|
||||
ctx: &mut CodeGenContext<'ctx, '_>,
|
||||
pub fn call_ndarray_calc_nd_indices<'ctx, 'a>(
|
||||
generator: &mut dyn CodeGenerator,
|
||||
ctx: &mut CodeGenContext<'ctx, 'a>,
|
||||
index: IntValue<'ctx>,
|
||||
ndarray: PointerValue<'ctx>,
|
||||
) -> Result<PointerValue<'ctx>, String> {
|
||||
@ -680,12 +675,12 @@ pub fn call_ndarray_calc_nd_indices<'ctx>(
|
||||
|
||||
let llvm_pusize = llvm_usize.ptr_type(AddressSpace::default());
|
||||
|
||||
let ndarray_calc_nd_indices_fn_name = match llvm_usize.get_bit_width() {
|
||||
let ndarray_calc_nd_indices_dn_name = match generator.get_size_type(ctx.ctx).get_bit_width() {
|
||||
32 => "__nac3_ndarray_calc_nd_indices",
|
||||
64 => "__nac3_ndarray_calc_nd_indices64",
|
||||
bw => unreachable!("Unsupported size type bit width: {}", bw)
|
||||
};
|
||||
let ndarray_calc_nd_indices_fn = ctx.module.get_function(ndarray_calc_nd_indices_fn_name).unwrap_or_else(|| {
|
||||
let ndarray_calc_nd_indices_fn = ctx.module.get_function(ndarray_calc_nd_indices_dn_name).unwrap_or_else(|| {
|
||||
let fn_type = llvm_void.fn_type(
|
||||
&[
|
||||
llvm_usize.into(),
|
||||
@ -696,7 +691,7 @@ pub fn call_ndarray_calc_nd_indices<'ctx>(
|
||||
false,
|
||||
);
|
||||
|
||||
ctx.module.add_function(ndarray_calc_nd_indices_fn_name, fn_type, None)
|
||||
ctx.module.add_function(ndarray_calc_nd_indices_dn_name, fn_type, None)
|
||||
});
|
||||
|
||||
let ndarray_num_dims = ctx.build_gep_and_load(
|
||||
|
@ -1,12 +1,18 @@
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define usize size_t
|
||||
#if __SIZEOF_POINTER__ == 8
|
||||
#define usize uint64_t
|
||||
#elif __SIZEOF_POINTER__ == 4
|
||||
#define usize uint32_t
|
||||
#else
|
||||
#error "Unsupported platform - Platform is not 32-bit or 64-bit"
|
||||
#endif
|
||||
|
||||
double dbl_nan(void) {
|
||||
return NAN;
|
||||
|
@ -17,9 +17,6 @@ while [ $# -ge 1 ]; do
|
||||
--lli)
|
||||
use_lli=1
|
||||
;;
|
||||
--debug)
|
||||
debug=1
|
||||
;;
|
||||
*)
|
||||
nac3args+=("$1")
|
||||
;;
|
||||
@ -27,9 +24,7 @@ while [ $# -ge 1 ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -n "$debug" ] && [ -e ../../target/debug/nac3standalone ]; then
|
||||
nac3standalone=../../target/debug/nac3standalone
|
||||
elif [ -e ../../target/release/nac3standalone ]; then
|
||||
if [ -e ../../target/release/nac3standalone ]; then
|
||||
nac3standalone=../../target/release/nac3standalone
|
||||
else
|
||||
# used by Nix builds
|
||||
|
Loading…
Reference in New Issue
Block a user