2016-02-11 06:41:50 +08:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2017-12-27 08:44:08 +08:00
|
|
|
#include <zig_llvm.h>
|
2016-02-11 06:41:50 +08:00
|
|
|
|
2016-02-11 16:33:27 +08:00
|
|
|
struct Buf;
|
|
|
|
|
2016-02-11 06:41:50 +08:00
|
|
|
struct ArchType {
|
2016-02-11 07:58:15 +08:00
|
|
|
ZigLLVM_ArchType arch;
|
2016-02-11 06:41:50 +08:00
|
|
|
ZigLLVM_SubArchType sub_arch;
|
|
|
|
};
|
|
|
|
|
2016-02-11 16:33:27 +08:00
|
|
|
struct ZigTarget {
|
|
|
|
ArchType arch;
|
|
|
|
ZigLLVM_VendorType vendor;
|
|
|
|
ZigLLVM_OSType os;
|
2016-02-17 11:03:41 +08:00
|
|
|
ZigLLVM_EnvironmentType env_type;
|
2016-02-11 16:33:27 +08:00
|
|
|
ZigLLVM_ObjectFormatType oformat;
|
|
|
|
};
|
|
|
|
|
2016-02-13 03:07:11 +08:00
|
|
|
enum CIntType {
|
|
|
|
CIntTypeShort,
|
|
|
|
CIntTypeUShort,
|
|
|
|
CIntTypeInt,
|
|
|
|
CIntTypeUInt,
|
|
|
|
CIntTypeLong,
|
|
|
|
CIntTypeULong,
|
|
|
|
CIntTypeLongLong,
|
|
|
|
CIntTypeULongLong,
|
|
|
|
|
|
|
|
CIntTypeCount,
|
|
|
|
};
|
|
|
|
|
2016-09-16 02:05:15 +08:00
|
|
|
size_t target_arch_count(void);
|
2017-04-11 08:02:39 +08:00
|
|
|
const ArchType *get_target_arch(size_t index);
|
2016-02-12 09:33:04 +08:00
|
|
|
void get_arch_name(char *out_str, const ArchType *arch);
|
2016-02-11 06:41:50 +08:00
|
|
|
|
2016-09-16 02:05:15 +08:00
|
|
|
size_t target_vendor_count(void);
|
2017-04-11 08:02:39 +08:00
|
|
|
ZigLLVM_VendorType get_target_vendor(size_t index);
|
2016-02-11 06:41:50 +08:00
|
|
|
|
2016-09-16 02:05:15 +08:00
|
|
|
size_t target_os_count(void);
|
2017-04-11 08:02:39 +08:00
|
|
|
ZigLLVM_OSType get_target_os(size_t index);
|
2016-02-11 07:58:15 +08:00
|
|
|
const char *get_target_os_name(ZigLLVM_OSType os_type);
|
2016-02-11 06:41:50 +08:00
|
|
|
|
2016-09-16 02:05:15 +08:00
|
|
|
size_t target_environ_count(void);
|
2017-04-11 08:02:39 +08:00
|
|
|
ZigLLVM_EnvironmentType get_target_environ(size_t index);
|
2016-02-11 06:41:50 +08:00
|
|
|
|
2016-08-18 11:11:04 +08:00
|
|
|
|
2016-09-16 02:05:15 +08:00
|
|
|
size_t target_oformat_count(void);
|
2017-04-11 08:02:39 +08:00
|
|
|
const ZigLLVM_ObjectFormatType get_target_oformat(size_t index);
|
2016-08-18 11:11:04 +08:00
|
|
|
const char *get_target_oformat_name(ZigLLVM_ObjectFormatType oformat);
|
|
|
|
|
2016-02-11 16:33:27 +08:00
|
|
|
void get_native_target(ZigTarget *target);
|
|
|
|
void get_unknown_target(ZigTarget *target);
|
|
|
|
|
|
|
|
int parse_target_arch(const char *str, ArchType *arch);
|
|
|
|
int parse_target_os(const char *str, ZigLLVM_OSType *os);
|
2016-02-17 11:03:41 +08:00
|
|
|
int parse_target_environ(const char *str, ZigLLVM_EnvironmentType *env_type);
|
2016-02-11 16:33:27 +08:00
|
|
|
|
|
|
|
void init_all_targets(void);
|
|
|
|
|
|
|
|
void get_target_triple(Buf *triple, const ZigTarget *target);
|
|
|
|
|
|
|
|
void resolve_target_object_format(ZigTarget *target);
|
|
|
|
|
2017-04-11 08:02:39 +08:00
|
|
|
uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id);
|
2016-02-11 16:33:27 +08:00
|
|
|
|
2017-04-05 19:46:50 +08:00
|
|
|
const char *target_o_file_ext(ZigTarget *target);
|
2017-11-03 21:09:33 +08:00
|
|
|
const char *target_asm_file_ext(ZigTarget *target);
|
|
|
|
const char *target_llvm_ir_file_ext(ZigTarget *target);
|
2017-08-31 23:41:58 +08:00
|
|
|
const char *target_exe_file_ext(ZigTarget *target);
|
2017-04-05 19:46:50 +08:00
|
|
|
|
2017-04-13 13:15:25 +08:00
|
|
|
Buf *target_dynamic_linker(ZigTarget *target);
|
|
|
|
|
2017-10-01 02:40:16 +08:00
|
|
|
bool target_can_exec(const ZigTarget *host_target, const ZigTarget *guest_target);
|
|
|
|
|
2017-04-13 13:15:25 +08:00
|
|
|
|
2016-02-11 06:41:50 +08:00
|
|
|
#endif
|