aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_abi.cpp
diff options
context:
space:
mode:
authorTohei Ichikawa <ichikawa.tohei.desu@gmail.com>2025-09-24 21:09:31 -0400
committerTohei Ichikawa <ichikawa.tohei.desu@gmail.com>2025-09-24 21:09:31 -0400
commit6ed9351955a8996418a8da10cd7b0da179734095 (patch)
tree1ddd4476a5b9d2af23f3240eaf31e7bfe28df9f1 /src/llvm_abi.cpp
parent3c1238991ba6f68f4ea31ca8ed368387821fa7d7 (diff)
parent5d3092bf2d00a46311a5f785658f04c823a9f3fa (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/llvm_abi.cpp')
-rw-r--r--src/llvm_abi.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp
index 8dbb8fa76..9f2faaa08 100644
--- a/src/llvm_abi.cpp
+++ b/src/llvm_abi.cpp
@@ -522,6 +522,23 @@ namespace lbAbiAmd64Win64 {
}
};
+
+gb_internal bool is_llvm_type_slice_like(LLVMTypeRef type) {
+ if (!lb_is_type_kind(type, LLVMStructTypeKind)) {
+ return false;
+ }
+ if (LLVMCountStructElementTypes(type) != 2) {
+ return false;
+ }
+ LLVMTypeRef fields[2] = {};
+ LLVMGetStructElementTypes(type, fields);
+ if (!lb_is_type_kind(fields[0], LLVMPointerTypeKind)) {
+ return false;
+ }
+ return lb_is_type_kind(fields[1], LLVMIntegerTypeKind) && lb_sizeof(fields[1]) == 8;
+
+}
+
// NOTE(bill): I hate `namespace` in C++ but this is just because I don't want to prefix everything
namespace lbAbiAmd64SysV {
enum RegClass {
@@ -652,23 +669,6 @@ namespace lbAbiAmd64SysV {
return false;
}
- gb_internal bool is_llvm_type_slice_like(LLVMTypeRef type) {
- if (!lb_is_type_kind(type, LLVMStructTypeKind)) {
- return false;
- }
- if (LLVMCountStructElementTypes(type) != 2) {
- return false;
- }
- LLVMTypeRef fields[2] = {};
- LLVMGetStructElementTypes(type, fields);
- if (!lb_is_type_kind(fields[0], LLVMPointerTypeKind)) {
- return false;
- }
- return lb_is_type_kind(fields[1], LLVMIntegerTypeKind) && lb_sizeof(fields[1]) == 8;
-
- }
-
-
gb_internal bool is_aggregate(LLVMTypeRef type) {
LLVMTypeKind kind = LLVMGetTypeKind(type);
switch (kind) {