mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 03:44:46 +01:00
Deleted 16,000+ lines of c++ code, including:
* an implementation of blake hashing
* the cache hash system
* compiler.cpp
* all the linking code, and everything having to do with building
glibc, musl, and mingw-w64
* much of the stage1 compiler internals got slimmed down since it
now assumes it is always outputting an object file.
More stuff:
* stage1 is now built with a different strategy: we have a tiny
zig0.cpp which is a slimmed down version of what stage1 main.cpp used
to be. Its only purpose is to build stage2 zig code into an object
file, which is then linked by the host build system (cmake) into
stage1. zig0.cpp uses the same C API that stage2 now has access to,
so that stage2 zig code can call into stage1 c++ code.
- stage1.h is
- stage2.h is
- stage1.zig is the main entry point for the Zig/C++
hybrid compiler. It has the functions exported from Zig, called
in C++, and bindings for the functions exported from C++, called
from Zig.
* removed the memory profiling instrumentation from stage1.
Abandon ship!
* Re-added the sections to the README about how to build stage2 and
stage3.
* stage2 now knows as a comptime boolean whether it is being compiled
as part of stage1 or as stage2.
- TODO use this flag to call into stage1 for compiling zig code.
* introduce -fdll-export-fns and -fno-dll-export-fns and clarify
its relationship to link_mode (static/dynamic)
* implement depending on LLVM to detect native target cpu features when
LLVM extensions are enabled and zig lacks CPU feature detection for
that target architecture.
* C importing is broken, will need some stage2 support to function
again.
103 lines
3.5 KiB
C++
103 lines
3.5 KiB
C++
/*
|
|
* Copyright (c) 2016 Andrew Kelley
|
|
*
|
|
* This file is part of zig, which is MIT licensed.
|
|
* See http://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#ifndef ZIG_TARGET_HPP
|
|
#define ZIG_TARGET_HPP
|
|
|
|
#include "stage2.h"
|
|
|
|
struct Buf;
|
|
|
|
enum CIntType {
|
|
CIntTypeShort,
|
|
CIntTypeUShort,
|
|
CIntTypeInt,
|
|
CIntTypeUInt,
|
|
CIntTypeLong,
|
|
CIntTypeULong,
|
|
CIntTypeLongLong,
|
|
CIntTypeULongLong,
|
|
|
|
CIntTypeCount,
|
|
};
|
|
|
|
Error target_parse_triple(ZigTarget *target, const char *triple, const char *mcpu, const char *dynamic_linker);
|
|
Error target_parse_arch(ZigLLVM_ArchType *arch, const char *arch_ptr, size_t arch_len);
|
|
Error target_parse_os(Os *os, const char *os_ptr, size_t os_len);
|
|
Error target_parse_abi(ZigLLVM_EnvironmentType *abi, const char *abi_ptr, size_t abi_len);
|
|
|
|
size_t target_arch_count(void);
|
|
ZigLLVM_ArchType target_arch_enum(size_t index);
|
|
const char *target_arch_name(ZigLLVM_ArchType arch);
|
|
|
|
const char *arch_stack_pointer_register_name(ZigLLVM_ArchType arch);
|
|
|
|
size_t target_vendor_count(void);
|
|
ZigLLVM_VendorType target_vendor_enum(size_t index);
|
|
|
|
size_t target_os_count(void);
|
|
Os target_os_enum(size_t index);
|
|
const char *target_os_name(Os os_type);
|
|
|
|
size_t target_abi_count(void);
|
|
ZigLLVM_EnvironmentType target_abi_enum(size_t index);
|
|
const char *target_abi_name(ZigLLVM_EnvironmentType abi);
|
|
ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os);
|
|
|
|
|
|
size_t target_oformat_count(void);
|
|
ZigLLVM_ObjectFormatType target_oformat_enum(size_t index);
|
|
const char *target_oformat_name(ZigLLVM_ObjectFormatType oformat);
|
|
ZigLLVM_ObjectFormatType target_object_format(const ZigTarget *target);
|
|
|
|
void target_triple_llvm(Buf *triple, const ZigTarget *target);
|
|
void target_triple_zig(Buf *triple, const ZigTarget *target);
|
|
|
|
void init_all_targets(void);
|
|
|
|
void resolve_target_object_format(ZigTarget *target);
|
|
|
|
uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id);
|
|
|
|
const char *target_o_file_ext(const ZigTarget *target);
|
|
const char *target_asm_file_ext(const ZigTarget *target);
|
|
const char *target_llvm_ir_file_ext(const ZigTarget *target);
|
|
|
|
bool target_can_exec(const ZigTarget *host_target, const ZigTarget *guest_target);
|
|
ZigLLVM_OSType get_llvm_os_type(Os os_type);
|
|
|
|
bool target_is_arm(const ZigTarget *target);
|
|
bool target_is_mips(const ZigTarget *target);
|
|
bool target_is_ppc(const ZigTarget *target);
|
|
bool target_allows_addr_zero(const ZigTarget *target);
|
|
bool target_has_valgrind_support(const ZigTarget *target);
|
|
bool target_os_is_darwin(Os os);
|
|
bool target_os_requires_libc(Os os);
|
|
bool target_can_build_libc(const ZigTarget *target);
|
|
const char *target_libc_generic_name(const ZigTarget *target);
|
|
bool target_is_libc_lib_name(const ZigTarget *target, const char *name);
|
|
bool target_is_libcpp_lib_name(const ZigTarget *target, const char *name);
|
|
bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi);
|
|
bool target_abi_is_musl(ZigLLVM_EnvironmentType abi);
|
|
bool target_is_glibc(const ZigTarget *target);
|
|
bool target_is_musl(const ZigTarget *target);
|
|
bool target_is_wasm(const ZigTarget *target);
|
|
bool target_is_riscv(const ZigTarget *target);
|
|
bool target_is_android(const ZigTarget *target);
|
|
bool target_has_debug_info(const ZigTarget *target);
|
|
const char *target_arch_musl_name(ZigLLVM_ArchType arch);
|
|
|
|
uint32_t target_arch_pointer_bit_width(ZigLLVM_ArchType arch);
|
|
uint32_t target_arch_largest_atomic_bits(ZigLLVM_ArchType arch);
|
|
|
|
size_t target_libc_count(void);
|
|
void target_libc_enum(size_t index, ZigTarget *out_target);
|
|
bool target_libc_needs_crti_crtn(const ZigTarget *target);
|
|
|
|
unsigned target_fn_align(const ZigTarget *target);
|
|
|
|
#endif
|