| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | #include <llvm/Object/COFFImportFile.h> |
| 39 | 39 | #include <llvm/Object/COFFModuleDefinition.h> |
| 40 | 40 | #include <llvm/PassRegistry.h> |
| 41 | #include <llvm/Support/CommandLine.h> |
| 41 | 42 | #include <llvm/Support/FileSystem.h> |
| 42 | 43 | #include <llvm/Support/TargetParser.h> |
| 43 | 44 | #include <llvm/Support/Timer.h> |
| ... | ... | @@ -299,14 +300,16 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A |
| 299 | 300 | LLVMValueRef ZigLLVMBuildMemCpy(LLVMBuilderRef B, LLVMValueRef Dst, unsigned DstAlign, |
| 300 | 301 | LLVMValueRef Src, unsigned SrcAlign, LLVMValueRef Size, bool isVolatile) |
| 301 | 302 | { |
| 302 | | CallInst *call_inst = unwrap(B)->CreateMemCpy(unwrap(Dst), DstAlign, unwrap(Src), SrcAlign, unwrap(Size), isVolatile); |
| 303 | CallInst *call_inst = unwrap(B)->CreateMemCpy(unwrap(Dst), |
| 304 | MaybeAlign(DstAlign), unwrap(Src), MaybeAlign(SrcAlign), unwrap(Size), isVolatile); |
| 303 | 305 | return wrap(call_inst); |
| 304 | 306 | } |
| 305 | 307 | |
| 306 | 308 | LLVMValueRef ZigLLVMBuildMemSet(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Val, LLVMValueRef Size, |
| 307 | 309 | unsigned Align, bool isVolatile) |
| 308 | 310 | { |
| 309 | | CallInst *call_inst = unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Size), Align, isVolatile); |
| 311 | CallInst *call_inst = unwrap(B)->CreateMemSet(unwrap(Ptr), unwrap(Val), unwrap(Size), |
| 312 | MaybeAlign(Align), isVolatile); |
| 310 | 313 | return wrap(call_inst); |
| 311 | 314 | } |
| 312 | 315 | |
| ... | ... | @@ -770,7 +773,7 @@ void ZigLLVMAddFunctionAttrCold(LLVMValueRef fn_ref) { |
| 770 | 773 | } |
| 771 | 774 | |
| 772 | 775 | void ZigLLVMParseCommandLineOptions(size_t argc, const char *const *argv) { |
| 773 | | llvm::cl::ParseCommandLineOptions(argc, argv); |
| 776 | cl::ParseCommandLineOptions(argc, argv); |
| 774 | 777 | } |
| 775 | 778 | |
| 776 | 779 | const char *ZigLLVMGetArchTypeName(ZigLLVM_ArchType arch) { |
| ... | ... | @@ -864,6 +867,8 @@ const char *ZigLLVMGetSubArchTypeName(ZigLLVM_SubArchType sub_arch) { |
| 864 | 867 | return "v5"; |
| 865 | 868 | case ZigLLVM_MipsSubArch_r6: |
| 866 | 869 | return "r6"; |
| 870 | case ZigLLVM_PPCSubArch_spe: |
| 871 | return "spe"; |
| 867 | 872 | } |
| 868 | 873 | abort(); |
| 869 | 874 | } |
| ... | ... | @@ -1072,11 +1077,14 @@ bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size |
| 1072 | 1077 | |
| 1073 | 1078 | |
| 1074 | 1079 | bool ZigLLDLink(ZigLLVM_ObjectFormatType oformat, const char **args, size_t arg_count, |
| 1075 | | void (*append_diagnostic)(void *, const char *, size_t), void *context) |
| 1080 | void (*append_diagnostic_stdout)(void *, const char *, size_t), |
| 1081 | void (*append_diagnostic_stderr)(void *, const char *, size_t), |
| 1082 | void *context) |
| 1076 | 1083 | { |
| 1077 | 1084 | ArrayRef<const char *> array_ref_args(args, arg_count); |
| 1078 | 1085 | |
| 1079 | | MyOStream diag(append_diagnostic, context); |
| 1086 | MyOStream diag_stdout(append_diagnostic_stdout, context); |
| 1087 | MyOStream diag_stderr(append_diagnostic_stderr, context); |
| 1080 | 1088 | |
| 1081 | 1089 | switch (oformat) { |
| 1082 | 1090 | case ZigLLVM_UnknownObjectFormat: |
| ... | ... | @@ -1084,16 +1092,16 @@ bool ZigLLDLink(ZigLLVM_ObjectFormatType oformat, const char **args, size_t arg_ |
| 1084 | 1092 | assert(false); // unreachable |
| 1085 | 1093 | |
| 1086 | 1094 | case ZigLLVM_COFF: |
| 1087 | | return lld::coff::link(array_ref_args, false, diag); |
| 1095 | return lld::coff::link(array_ref_args, false, diag_stdout, diag_stderr); |
| 1088 | 1096 | |
| 1089 | 1097 | case ZigLLVM_ELF: |
| 1090 | | return lld::elf::link(array_ref_args, false, diag); |
| 1098 | return lld::elf::link(array_ref_args, false, diag_stdout, diag_stderr); |
| 1091 | 1099 | |
| 1092 | 1100 | case ZigLLVM_MachO: |
| 1093 | | return lld::mach_o::link(array_ref_args, false, diag); |
| 1101 | return lld::mach_o::link(array_ref_args, false, diag_stdout, diag_stderr); |
| 1094 | 1102 | |
| 1095 | 1103 | case ZigLLVM_Wasm: |
| 1096 | | return lld::wasm::link(array_ref_args, false, diag); |
| 1104 | return lld::wasm::link(array_ref_args, false, diag_stdout, diag_stderr); |
| 1097 | 1105 | } |
| 1098 | 1106 | assert(false); // unreachable |
| 1099 | 1107 | abort(); |
| ... | ... | @@ -1154,6 +1162,7 @@ static_assert((Triple::ArchType)ZigLLVM_arm == Triple::arm, ""); |
| 1154 | 1162 | static_assert((Triple::ArchType)ZigLLVM_armeb == Triple::armeb, ""); |
| 1155 | 1163 | static_assert((Triple::ArchType)ZigLLVM_aarch64 == Triple::aarch64, ""); |
| 1156 | 1164 | static_assert((Triple::ArchType)ZigLLVM_aarch64_be == Triple::aarch64_be, ""); |
| 1165 | static_assert((Triple::ArchType)ZigLLVM_aarch64_32 == Triple::aarch64_32, ""); |
| 1157 | 1166 | static_assert((Triple::ArchType)ZigLLVM_arc == Triple::arc, ""); |
| 1158 | 1167 | static_assert((Triple::ArchType)ZigLLVM_avr == Triple::avr, ""); |
| 1159 | 1168 | static_assert((Triple::ArchType)ZigLLVM_bpfel == Triple::bpfel, ""); |
| ... | ... | @@ -1199,6 +1208,7 @@ static_assert((Triple::ArchType)ZigLLVM_wasm32 == Triple::wasm32, ""); |
| 1199 | 1208 | static_assert((Triple::ArchType)ZigLLVM_wasm64 == Triple::wasm64, ""); |
| 1200 | 1209 | static_assert((Triple::ArchType)ZigLLVM_renderscript32 == Triple::renderscript32, ""); |
| 1201 | 1210 | static_assert((Triple::ArchType)ZigLLVM_renderscript64 == Triple::renderscript64, ""); |
| 1211 | static_assert((Triple::ArchType)ZigLLVM_ve == Triple::ve, ""); |
| 1202 | 1212 | static_assert((Triple::ArchType)ZigLLVM_LastArchType == Triple::LastArchType, ""); |
| 1203 | 1213 | |
| 1204 | 1214 | static_assert((Triple::SubArchType)ZigLLVM_NoSubArch == Triple::NoSubArch, ""); |
| ... | ... | @@ -1229,6 +1239,7 @@ static_assert((Triple::SubArchType)ZigLLVM_KalimbaSubArch_v4 == Triple::KalimbaS |
| 1229 | 1239 | static_assert((Triple::SubArchType)ZigLLVM_KalimbaSubArch_v5 == Triple::KalimbaSubArch_v5, ""); |
| 1230 | 1240 | static_assert((Triple::SubArchType)ZigLLVM_KalimbaSubArch_v5 == Triple::KalimbaSubArch_v5, ""); |
| 1231 | 1241 | static_assert((Triple::SubArchType)ZigLLVM_MipsSubArch_r6 == Triple::MipsSubArch_r6, ""); |
| 1242 | static_assert((Triple::SubArchType)ZigLLVM_PPCSubArch_spe == Triple::PPCSubArch_spe, ""); |
| 1232 | 1243 | |
| 1233 | 1244 | static_assert((Triple::VendorType)ZigLLVM_UnknownVendor == Triple::UnknownVendor, ""); |
| 1234 | 1245 | static_assert((Triple::VendorType)ZigLLVM_Apple == Triple::Apple, ""); |
| ... | ... | @@ -1299,8 +1310,6 @@ static_assert((Triple::EnvironmentType)ZigLLVM_GNUX32 == Triple::GNUX32, ""); |
| 1299 | 1310 | static_assert((Triple::EnvironmentType)ZigLLVM_CODE16 == Triple::CODE16, ""); |
| 1300 | 1311 | static_assert((Triple::EnvironmentType)ZigLLVM_EABI == Triple::EABI, ""); |
| 1301 | 1312 | static_assert((Triple::EnvironmentType)ZigLLVM_EABIHF == Triple::EABIHF, ""); |
| 1302 | | static_assert((Triple::EnvironmentType)ZigLLVM_ELFv1 == Triple::ELFv1, ""); |
| 1303 | | static_assert((Triple::EnvironmentType)ZigLLVM_ELFv2 == Triple::ELFv2, ""); |
| 1304 | 1313 | static_assert((Triple::EnvironmentType)ZigLLVM_Android == Triple::Android, ""); |
| 1305 | 1314 | static_assert((Triple::EnvironmentType)ZigLLVM_Musl == Triple::Musl, ""); |
| 1306 | 1315 | static_assert((Triple::EnvironmentType)ZigLLVM_MuslEABI == Triple::MuslEABI, ""); |
| ... | ... | @@ -1310,6 +1319,7 @@ static_assert((Triple::EnvironmentType)ZigLLVM_Itanium == Triple::Itanium, ""); |
| 1310 | 1319 | static_assert((Triple::EnvironmentType)ZigLLVM_Cygnus == Triple::Cygnus, ""); |
| 1311 | 1320 | static_assert((Triple::EnvironmentType)ZigLLVM_CoreCLR == Triple::CoreCLR, ""); |
| 1312 | 1321 | static_assert((Triple::EnvironmentType)ZigLLVM_Simulator == Triple::Simulator, ""); |
| 1322 | static_assert((Triple::EnvironmentType)ZigLLVM_MacABI == Triple::MacABI, ""); |
| 1313 | 1323 | static_assert((Triple::EnvironmentType)ZigLLVM_LastEnvironmentType == Triple::LastEnvironmentType, ""); |
| 1314 | 1324 | |
| 1315 | 1325 | static_assert((Triple::ObjectFormatType)ZigLLVM_UnknownObjectFormat == Triple::UnknownObjectFormat, ""); |