@designliquido/llvm-bindings 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,8 +15,8 @@ on:
15
15
  - 'LICENSE'
16
16
 
17
17
  env:
18
- LLVM_VERSION: 14.0.6
19
- LLVM_VERSION_MAJOR: 14
18
+ LLVM_VERSION: 15.0.7
19
+ LLVM_VERSION_MAJOR: 15
20
20
 
21
21
  jobs:
22
22
  build-push:
@@ -56,7 +56,7 @@ jobs:
56
56
  if: startsWith(matrix.os, 'windows')
57
57
  run: |
58
58
  $LLVM_VERSION = "${{ env.LLVM_VERSION }}"
59
- $LLVM_PREBUILT_FILE = "llvm-$LLVM_VERSION-windows-2022.zip"
59
+ $LLVM_PREBUILT_FILE = "llvm-$LLVM_VERSION-windows-latest.zip"
60
60
  curl -sLO "https://github.com/DesignLiquido/llvm-windows/releases/download/llvmorg-$LLVM_VERSION/$LLVM_PREBUILT_FILE"
61
61
  Expand-Archive -Path $LLVM_PREBUILT_FILE -DestinationPath .
62
62
  $LLVM_CMAKE_DIR = "$pwd/LLVM-$LLVM_VERSION-win64/lib/cmake/llvm"
@@ -124,7 +124,7 @@ jobs:
124
124
  if: startsWith(matrix.os, 'windows')
125
125
  run: |
126
126
  $LLVM_VERSION = "${{ env.LLVM_VERSION }}"
127
- $LLVM_PREBUILT_FILE = "llvm-$LLVM_VERSION-windows-2022.zip"
127
+ $LLVM_PREBUILT_FILE = "llvm-$LLVM_VERSION-windows-latest.zip"
128
128
  curl -sLO "https://github.com/DesignLiquido/llvm-windows/releases/download/llvmorg-$LLVM_VERSION/$LLVM_PREBUILT_FILE"
129
129
  Expand-Archive -Path $LLVM_PREBUILT_FILE -DestinationPath .
130
130
  $LLVM_CMAKE_DIR = "$pwd/LLVM-$LLVM_VERSION-win64/lib/cmake/llvm"
package/CHANGELOG.md CHANGED
@@ -1,2 +1,22 @@
1
- ## [0.0.1](https://github.com/DesignLiquido/llvm-bindings/compare/v0.4.2...v0.0.1) (2026-03-06)
1
+ ## [1.0.0] - 2026-03-07
2
2
 
3
+ ### Added
4
+
5
+ - **Opaque pointer support (LLVM 15):** `PointerType.get` and `PointerType.getUnqual` now accept either a `Type` (typed pointer, existing behaviour) or an `LLVMContext` (opaque pointer, new in LLVM 15). No method renames — the overloads are resolved at runtime by inspecting the first argument.
6
+ - `PointerType.isOpaque()` — returns `true` when the pointer type carries no element type.
7
+ - `Type.isOpaquePointerTy()` — lets user code branch between typed- and opaque-pointer paths.
8
+ - `IRBuilder.getPtrTy(addrSpace?)` — returns the opaque `ptr` type; canonical replacement for `getInt8PtrTy()` in opaque-pointer IR.
9
+
10
+ ### Fixed
11
+
12
+ - `isSameType` (internal helper in `src/IR/Type.cpp`) no longer aborts when either pointer is opaque; it now guards the `getPointerElementType()` call and compares opaqueness directly.
13
+
14
+ ### Notes
15
+
16
+ - Typed-pointer APIs are unchanged. The LLVM 15 compatibility shim (`context->setOpaquePointers(false)`) remains active by default, so existing code continues to work without modification.
17
+
18
+ ---
19
+
20
+ ## [0.1.0]
21
+
22
+ Initial release.
package/CMakeLists.txt CHANGED
@@ -19,7 +19,7 @@ add_library(${PROJECT_NAME} SHARED ${CMAKE_JS_SRC} ${SOURCE_FILES})
19
19
  set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node" LINKER_LANGUAGE CXX)
20
20
 
21
21
  if (MSVC)
22
- # cmake-js forces /MT (MultiThreaded static CRT), but LLVM 14 prebuilt Windows
22
+ # cmake-js forces /MT (MultiThreaded static CRT), but LLVM 15 prebuilt Windows
23
23
  # libraries were compiled with /MD (MultiThreadedDLL dynamic CRT). Override
24
24
  # per-target so the linker can resolve __imp_strdup, __imp_read, etc. from ucrtbase.dll.
25
25
  set_property(TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  LLVM bindings for Node.js/JavaScript/TypeScript. This project is a hard fork of https://github.com/ApsarasX/llvm-bindings, which it does not seem to be maintained anymore.
4
4
 
5
- [![github-action](https://img.shields.io/github/workflow/status/DesignLiquido/llvm-bindings/Build?style=flat-square)](https://github.com/DesignLiquido/llvm-bindings/actions)
5
+ [![github-action](https://img.shields.io/github/actions/workflow/status/DesignLiquido/llvm-bindings/build.yml?style=flat-square)](https://github.com/DesignLiquido/llvm-bindings/actions)
6
6
  [![npm](https://img.shields.io/npm/v/@designliquido/llvm-bindings?style=flat-square)](https://www.npmjs.com/package/@designliquido/llvm-bindings)
7
7
  [![github-license](https://img.shields.io/github/license/DesignLiquido/llvm-bindings?style=flat-square)](https://github.com/DesignLiquido/llvm-bindings/blob/master/LICENSE)
8
8
 
@@ -28,7 +28,7 @@ listed in the [TypeScript definition file](./llvm-bindings.d.ts).
28
28
 
29
29
  ```shell
30
30
  # install cmake and llvm by homebrew
31
- brew install cmake llvm@14
31
+ brew install cmake llvm@15
32
32
 
33
33
  # install llvm-bindings by yarn
34
34
  yarn add llvm-bindings
@@ -40,7 +40,7 @@ yarn add llvm-bindings
40
40
  #install llvm by installation script
41
41
  wget https://apt.llvm.org/llvm.sh
42
42
  sudo chmod +x llvm.sh
43
- sudo ./llvm.sh 14
43
+ sudo ./llvm.sh 15
44
44
 
45
45
  # install cmake and zlib by apt-get
46
46
  sudo apt-get install cmake zlib1g-dev
@@ -53,14 +53,14 @@ yarn add llvm-bindings
53
53
 
54
54
  First, please refer to [Build LLVM from sources on Windows 10](https://github.com/ApsarasX/llvm-bindings/wiki/Build-LLVM-from-source-code-on-Windows-10) to build LLVM. An alternative is to download [prebuilt LLVM binary](https://github.com/ApsarasX/llvm-windows/releases).
55
55
 
56
- Then, find the `llvm-config` command in your LLVM build directory and execute `llvm-config --cmakedir` to get LLVM cmake directory, assuming `C:\Users\dev\llvm-13.0.1.src\build\lib\cmake\llvm`.
56
+ Then, find the `llvm-config` command in your LLVM build directory and execute `llvm-config --cmakedir` to get LLVM cmake directory, assuming `C:\Users\dev\llvm-15.0.7.src\build\lib\cmake\llvm`.
57
57
 
58
58
  Finally, execute the following commands.
59
59
 
60
60
  ```shell
61
61
  # specify the LLVM cmake directory for cmake-js
62
62
  # note: cmake-js reads npm-style config keys
63
- npm config set cmake_LLVM_DIR C:\Users\dev\llvm-13.0.1.src\build\lib\cmake\llvm
63
+ npm config set cmake_LLVM_DIR C:\Users\dev\llvm-15.0.7.src\build\lib\cmake\llvm
64
64
 
65
65
  # install llvm-bindings by yarn
66
66
  yarn add llvm-bindings
@@ -120,14 +120,36 @@ main();
120
120
  ## Note
121
121
  Due to the limitation of `node-addon-api`, this project has not implemented inheritance yet, so calling the method of superclass from subclass object will report an error. Please see [#1](https://github.com/ApsarasX/llvm-bindings/issues/1) for details.
122
122
 
123
+ ## Opaque Pointers (LLVM 15 / v1.0.0)
124
+
125
+ LLVM 15 makes opaque pointers the default. Starting from v1.0.0 this library exposes the necessary APIs to opt into opaque-pointer IR while keeping all existing typed-pointer APIs intact.
126
+
127
+ **New APIs**
128
+
129
+ | API | Description |
130
+ |-----|-------------|
131
+ | `PointerType.get(context, addrSpace)` | Creates an opaque pointer type (pass `LLVMContext` instead of `Type`) |
132
+ | `PointerType.getUnqual(context)` | Shorthand for address space 0 opaque pointer |
133
+ | `PointerType.isOpaque()` | Returns `true` if the pointer type carries no element type |
134
+ | `Type.isOpaquePointerTy()` | Returns `true` if the type is an opaque pointer |
135
+ | `IRBuilder.getPtrTy(addrSpace?)` | Returns the opaque `ptr` type; replaces `getInt8PtrTy()` in opaque-pointer IR |
136
+
137
+ **Compatibility shim**
138
+
139
+ Typed-pointer code continues to work without changes. The compatibility flag `context->setOpaquePointers(false)` is set automatically in `LLVMContext`'s constructor, so existing code is unaffected.
140
+
141
+ To opt into opaque pointers, pass an `LLVMContext` to `PointerType.get` / `getUnqual` and use `getPtrTy()` for generic pointer values.
142
+
123
143
  ## Compatibility
124
144
 
125
- | llvm-bindings versions | compatible LLVM versions |
126
- |------------------------|--------------------------|
127
- | 0.0.x, 0.1.x | 11.0.x, 11.1.x |
128
- | 0.2.x | 12.0.x |
129
- | 0.3.x | 13.0.x |
130
- | 0.4.x | 14.0.x |
145
+ | llvm-bindings versions | compatible LLVM versions |
146
+ |--------------------------------------------|--------------------------|
147
+ | (original llvm-bindings repo) 0.0.x, 0.1.x | 11.0.x, 11.1.x |
148
+ | (original llvm-bindings repo) 0.2.x | 12.0.x |
149
+ | (original llvm-bindings repo) 0.3.x | 13.0.x |
150
+ | (original llvm-bindings repo) 0.4.x | 14.0.x |
151
+ | (@designliquido/llvm-bindings) 0.1.x | 15.0.x |
152
+ | (@designliquido/llvm-bindings) 1.0.x | 15.0.x |
131
153
 
132
154
  ## Acknowledgments
133
155
 
package/cmake/LLVM.cmake CHANGED
@@ -7,7 +7,7 @@ if (CMAKE_HOST_APPLE)
7
7
  endforeach ()
8
8
  endif ()
9
9
 
10
- find_package(LLVM 14 REQUIRED CONFIG)
10
+ find_package(LLVM 15 REQUIRED CONFIG)
11
11
 
12
12
  message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
13
13
 
@@ -229,4 +229,6 @@ private:
229
229
  Napi::Value getTypeID(const Napi::CallbackInfo &info);
230
230
 
231
231
  Napi::Value getPointerElementType(const Napi::CallbackInfo &info);
232
+
233
+ Napi::Value isOpaque(const Napi::CallbackInfo &info);
232
234
  };
@@ -179,6 +179,8 @@ private:
179
179
 
180
180
  Napi::Value getInt8PtrTy(const Napi::CallbackInfo &info);
181
181
 
182
+ Napi::Value getPtrTy(const Napi::CallbackInfo &info);
183
+
182
184
  Napi::Value getIntPtrTy(const Napi::CallbackInfo &info);
183
185
 
184
186
  //===--------------------------------------------------------------------===//
@@ -74,8 +74,8 @@ namespace ErrMsg {
74
74
  }
75
75
  namespace PointerType {
76
76
  constexpr const char *constructor = "PointerType.constructor needs to be called with new (external: Napi::External<llvm::PointerType>)";
77
- constexpr const char *get = "PointerType.get needs to be called with: (elementType: Type, addrSpace: number)";
78
- constexpr const char *getUnqual = "PointerType.getUnqual needs to be called with: (elementType: Type)";
77
+ constexpr const char *get = "PointerType.get needs to be called with: (elementType: Type | context: LLVMContext, addrSpace: number)";
78
+ constexpr const char *getUnqual = "PointerType.getUnqual needs to be called with: (elementType: Type | context: LLVMContext)";
79
79
  }
80
80
  namespace Value {
81
81
  constexpr const char *constructor = "Value.constructor needs to be called with new (external: Napi::External<llvm::Value>)";
@@ -406,6 +406,7 @@ namespace ErrMsg {
406
406
 
407
407
  constexpr const char *getIntNTy = "IRBuilder.getIntNTy needs to be called with (numBits: number)";
408
408
  constexpr const char *getInt8PtrTy = "IRBuilder.getInt8PtrTy needs to be called with (addrSpace?: number)";
409
+ constexpr const char *getPtrTy = "IRBuilder.getPtrTy needs to be called with (addrSpace?: number)";
409
410
  constexpr const char *getIntPtrTy = "IRBuilder.getIntPtrTy needs to be called with (dataLayout: DataLayout, addrSpace?: number)";
410
411
 
411
412
  constexpr const char *CreateRet = "IRBuilder.CreateRet needs to be called with: (value: Value)";
@@ -247,7 +247,6 @@ declare namespace llvm {
247
247
  VoidTyID: number;
248
248
  LabelTyID: number;
249
249
  MetadataTyID: number;
250
- X86_MMXTyID: number;
251
250
  TokenTyID: number;
252
251
  IntegerTyID: number;
253
252
  FunctionTyID: number;
@@ -278,8 +277,6 @@ declare namespace llvm {
278
277
 
279
278
  public static getPPC_FP128Ty(context: LLVMContext): Type;
280
279
 
281
- public static getX86_MMXTy(context: LLVMContext): Type;
282
-
283
280
  public static getTokenTy(context: LLVMContext): Type;
284
281
 
285
282
  public static getIntNTy(context: LLVMContext, numBits: number): IntegerType;
@@ -310,8 +307,6 @@ declare namespace llvm {
310
307
 
311
308
  public static getPPC_FP128PtrTy(context: LLVMContext, addrSpace?: number): PointerType;
312
309
 
313
- public static getX86_MMXPtrTy(context: LLVMContext, addrSpace?: number): PointerType;
314
-
315
310
  public static getInt1PtrTy(context: LLVMContext, addrSpace?: number): PointerType;
316
311
 
317
312
  public static getInt8PtrTy(context: LLVMContext, addrSpace?: number): PointerType;
@@ -342,8 +337,6 @@ declare namespace llvm {
342
337
 
343
338
  public isFloatingPointTy(): boolean;
344
339
 
345
- public isX86_MMXTy(): boolean;
346
-
347
340
  public isLabelTy(): boolean;
348
341
 
349
342
  public isMetadataTy(): boolean;
@@ -360,6 +353,8 @@ declare namespace llvm {
360
353
 
361
354
  public isPointerTy(): boolean;
362
355
 
356
+ public isOpaquePointerTy(): boolean;
357
+
363
358
  public isVectorTy(): boolean;
364
359
 
365
360
  public isEmptyTy(): boolean;
@@ -498,8 +493,10 @@ declare namespace llvm {
498
493
 
499
494
  class PointerType extends Type {
500
495
  public static get(elementType: Type, addrSpace: number): PointerType;
496
+ public static get(context: LLVMContext, addrSpace: number): PointerType;
501
497
 
502
498
  public static getUnqual(elementType: Type): PointerType;
499
+ public static getUnqual(context: LLVMContext): PointerType;
503
500
 
504
501
  // duplicated
505
502
  public isPointerTy(): boolean;
@@ -519,6 +516,8 @@ declare namespace llvm {
519
516
  // duplicated
520
517
  public getPointerElementType(): Type;
521
518
 
519
+ public isOpaque(): boolean;
520
+
522
521
  protected constructor();
523
522
  }
524
523
 
@@ -1427,6 +1426,8 @@ declare namespace llvm {
1427
1426
 
1428
1427
  public getInt8PtrTy(addrSpace?: number): PointerType;
1429
1428
 
1429
+ public getPtrTy(addrSpace?: number): PointerType;
1430
+
1430
1431
  public getIntPtrTy(dataLayout: DataLayout, addrSpace?: number): IntegerType;
1431
1432
 
1432
1433
  //===--------------------------------------------------------------------===//
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designliquido/llvm-bindings",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "LLVM bindings for Node.js/JavaScript/TypeScript",
5
5
  "keywords": [
6
6
  "llvm",
@@ -66,7 +66,7 @@
66
66
  "publish": true
67
67
  },
68
68
  "hooks": {
69
- "before:git:release": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
69
+ "before:git:release": "yarn conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
70
70
  }
71
71
  }
72
72
  }
@@ -565,7 +565,8 @@ void PointerType::Init(Napi::Env env, Napi::Object &exports) {
565
565
  InstanceMethod("isIntegerTy", &PointerType::isIntegerTy),
566
566
  InstanceMethod("isVoidTy", &PointerType::isVoidTy),
567
567
  InstanceMethod("getTypeID", &PointerType::getTypeID),
568
- InstanceMethod("getPointerElementType", &PointerType::getPointerElementType)
568
+ InstanceMethod("getPointerElementType", &PointerType::getPointerElementType),
569
+ InstanceMethod("isOpaque", &PointerType::isOpaque)
569
570
  });
570
571
  constructor = Napi::Persistent(func);
571
572
  constructor.SuppressDestruct();
@@ -599,22 +600,38 @@ PointerType::PointerType(const Napi::CallbackInfo &info) : ObjectWrap(info) {
599
600
 
600
601
  Napi::Value PointerType::get(const Napi::CallbackInfo &info) {
601
602
  Napi::Env env = info.Env();
602
- if (info.Length() < 2 || !Type::IsClassOf(info[0]) || !info[1].IsNumber()) {
603
+ if (info.Length() < 2 || !info[1].IsNumber()) {
603
604
  throw Napi::TypeError::New(env, ErrMsg::Class::PointerType::get);
604
605
  }
605
- llvm::Type *type = Type::Extract(info[0]);
606
606
  uint32_t addrSpace = info[1].As<Napi::Number>();
607
- llvm::PointerType *pointerType = llvm::PointerType::get(type, addrSpace);
607
+ llvm::PointerType *pointerType;
608
+ if (LLVMContext::IsClassOf(info[0])) {
609
+ llvm::LLVMContext &context = LLVMContext::Extract(info[0]);
610
+ pointerType = llvm::PointerType::get(context, addrSpace);
611
+ } else if (Type::IsClassOf(info[0])) {
612
+ llvm::Type *type = Type::Extract(info[0]);
613
+ pointerType = llvm::PointerType::get(type, addrSpace);
614
+ } else {
615
+ throw Napi::TypeError::New(env, ErrMsg::Class::PointerType::get);
616
+ }
608
617
  return PointerType::New(env, pointerType);
609
618
  }
610
619
 
611
620
  Napi::Value PointerType::getUnqual(const Napi::CallbackInfo &info) {
612
621
  Napi::Env env = info.Env();
613
- if (info.Length() == 0 || !Type::IsClassOf(info[0])) {
622
+ if (info.Length() == 0) {
623
+ throw Napi::TypeError::New(env, ErrMsg::Class::PointerType::getUnqual);
624
+ }
625
+ llvm::PointerType *pointerType;
626
+ if (LLVMContext::IsClassOf(info[0])) {
627
+ llvm::LLVMContext &context = LLVMContext::Extract(info[0]);
628
+ pointerType = llvm::PointerType::getUnqual(context);
629
+ } else if (Type::IsClassOf(info[0])) {
630
+ llvm::Type *type = Type::Extract(info[0]);
631
+ pointerType = llvm::PointerType::getUnqual(type);
632
+ } else {
614
633
  throw Napi::TypeError::New(env, ErrMsg::Class::PointerType::getUnqual);
615
634
  }
616
- llvm::Type *type = Type::Extract(info[0]);
617
- llvm::PointerType *pointerType = llvm::PointerType::getUnqual(type);
618
635
  return PointerType::New(env, pointerType);
619
636
  }
620
637
 
@@ -650,3 +667,7 @@ Napi::Value PointerType::getTypeID(const Napi::CallbackInfo &info) {
650
667
  Napi::Value PointerType::getPointerElementType(const Napi::CallbackInfo &info) {
651
668
  return Type::New(info.Env(), pointerType->getPointerElementType());
652
669
  }
670
+
671
+ Napi::Value PointerType::isOpaque(const Napi::CallbackInfo &info) {
672
+ return Napi::Boolean::New(info.Env(), pointerType->isOpaque());
673
+ }
@@ -53,6 +53,7 @@ void IRBuilder::Init(Napi::Env env, Napi::Object &exports) {
53
53
  InstanceMethod("getDoubleTy", &IRBuilder::getTypeFactory<&LLVMIRBuilder::getDoubleTy>),
54
54
  InstanceMethod("getVoidTy", &IRBuilder::getTypeFactory<&LLVMIRBuilder::getVoidTy>),
55
55
  InstanceMethod("getInt8PtrTy", &IRBuilder::getInt8PtrTy),
56
+ InstanceMethod("getPtrTy", &IRBuilder::getPtrTy),
56
57
  InstanceMethod("getIntPtrTy", &IRBuilder::getIntPtrTy),
57
58
 
58
59
  //===--------------------------------------------------------------------===//
@@ -395,6 +396,17 @@ Napi::Value IRBuilder::getInt8PtrTy(const Napi::CallbackInfo &info) {
395
396
  throw Napi::TypeError::New(env, ErrMsg::Class::IRBuilder::getInt8PtrTy);
396
397
  }
397
398
 
399
+ Napi::Value IRBuilder::getPtrTy(const Napi::CallbackInfo &info) {
400
+ Napi::Env env = info.Env();
401
+ unsigned argsLen = info.Length();
402
+ if (argsLen == 0 || argsLen == 1 && info[0].IsNumber()) {
403
+ unsigned addrSpace = argsLen == 1 ? info[0].As<Napi::Number>() : 0;
404
+ llvm::PointerType *type = builder->getPtrTy(addrSpace);
405
+ return PointerType::New(env, type);
406
+ }
407
+ throw Napi::TypeError::New(env, ErrMsg::Class::IRBuilder::getPtrTy);
408
+ }
409
+
398
410
  Napi::Value IRBuilder::getIntPtrTy(const Napi::CallbackInfo &info) {
399
411
  Napi::Env env = info.Env();
400
412
  unsigned argsLen = info.Length();
@@ -23,6 +23,7 @@ LLVMContext::LLVMContext(const Napi::CallbackInfo &info) : ObjectWrap(info) {
23
23
  throw Napi::TypeError::New(env, ErrMsg::Class::LLVMContext::constructor);
24
24
  }
25
25
  context = new llvm::LLVMContext();
26
+ context->setOpaquePointers(false);
26
27
  }
27
28
 
28
29
  llvm::LLVMContext &LLVMContext::getLLVMPrimitive() {
package/src/IR/Type.cpp CHANGED
@@ -59,7 +59,6 @@ void Type::Init(Napi::Env env, Napi::Object &exports) {
59
59
  typeID.Set("VoidTyID", Napi::Number::New(env, llvm::Type::TypeID::VoidTyID));
60
60
  typeID.Set("LabelTyID", Napi::Number::New(env, llvm::Type::TypeID::LabelTyID));
61
61
  typeID.Set("MetadataTyID", Napi::Number::New(env, llvm::Type::TypeID::MetadataTyID));
62
- typeID.Set("X86_MMXTyID", Napi::Number::New(env, llvm::Type::TypeID::X86_MMXTyID));
63
62
  typeID.Set("TokenTyID", Napi::Number::New(env, llvm::Type::TypeID::TokenTyID));
64
63
  typeID.Set("IntegerTyID", Napi::Number::New(env, llvm::Type::TypeID::IntegerTyID));
65
64
  typeID.Set("FunctionTyID", Napi::Number::New(env, llvm::Type::TypeID::FunctionTyID));
@@ -81,7 +80,6 @@ void Type::Init(Napi::Env env, Napi::Object &exports) {
81
80
  StaticMethod("getX86_FP80Ty", &getTypeFactory<&llvm::Type::getX86_FP80Ty>),
82
81
  StaticMethod("getFP128Ty", &getTypeFactory<&llvm::Type::getFP128Ty>),
83
82
  StaticMethod("getPPC_FP128Ty", &getTypeFactory<&llvm::Type::getPPC_FP128Ty>),
84
- StaticMethod("getX86_MMXTy", &getTypeFactory<&llvm::Type::getX86_MMXTy>),
85
83
  StaticMethod("getTokenTy", &getTypeFactory<&llvm::Type::getTokenTy>),
86
84
  StaticMethod("getIntNTy", &Type::getIntNTy),
87
85
  StaticMethod("getInt1Ty", &getIntTypeFactory<&llvm::Type::getInt1Ty>),
@@ -97,7 +95,6 @@ void Type::Init(Napi::Env env, Napi::Object &exports) {
97
95
  StaticMethod("getX86_FP80PtrTy", &getPointerTypeFactory<&llvm::Type::getX86_FP80PtrTy>),
98
96
  StaticMethod("getFP128PtrTy", &getPointerTypeFactory<&llvm::Type::getFP128PtrTy>),
99
97
  StaticMethod("getPPC_FP128PtrTy", &getPointerTypeFactory<&llvm::Type::getPPC_FP128PtrTy>),
100
- StaticMethod("getX86_MMXPtrTy", &getPointerTypeFactory<&llvm::Type::getX86_MMXPtrTy>),
101
98
  StaticMethod("getInt1PtrTy", &getPointerTypeFactory<&llvm::Type::getInt1PtrTy>),
102
99
  StaticMethod("getInt8PtrTy", &getPointerTypeFactory<&llvm::Type::getInt8PtrTy>),
103
100
  StaticMethod("getInt16PtrTy", &getPointerTypeFactory<&llvm::Type::getInt16PtrTy>),
@@ -113,7 +110,6 @@ void Type::Init(Napi::Env env, Napi::Object &exports) {
113
110
  InstanceMethod("isFP128Ty", &Type::isTypeFactory<&llvm::Type::isFP128Ty>),
114
111
  InstanceMethod("isPPC_FP128Ty", &Type::isTypeFactory<&llvm::Type::isPPC_FP128Ty>),
115
112
  InstanceMethod("isFloatingPointTy", &Type::isTypeFactory<&llvm::Type::isFloatingPointTy>),
116
- InstanceMethod("isX86_MMXTy", &Type::isTypeFactory<&llvm::Type::isX86_MMXTy>),
117
113
  InstanceMethod("isLabelTy", &Type::isTypeFactory<&llvm::Type::isLabelTy>),
118
114
  InstanceMethod("isMetadataTy", &Type::isTypeFactory<&llvm::Type::isMetadataTy>),
119
115
  InstanceMethod("isTokenTy", &Type::isTypeFactory<&llvm::Type::isTokenTy>),
@@ -122,6 +118,7 @@ void Type::Init(Napi::Env env, Napi::Object &exports) {
122
118
  InstanceMethod("isStructTy", &Type::isTypeFactory<&llvm::Type::isStructTy>),
123
119
  InstanceMethod("isArrayTy", &Type::isTypeFactory<&llvm::Type::isArrayTy>),
124
120
  InstanceMethod("isPointerTy", &Type::isTypeFactory<&llvm::Type::isPointerTy>),
121
+ InstanceMethod("isOpaquePointerTy", &Type::isTypeFactory<&llvm::Type::isOpaquePointerTy>),
125
122
  InstanceMethod("isVectorTy", &Type::isTypeFactory<&llvm::Type::isVectorTy>),
126
123
  InstanceMethod("isEmptyTy", &Type::isTypeFactory<&llvm::Type::isEmptyTy>),
127
124
  InstanceMethod("isFirstClassType", &Type::isTypeFactory<&llvm::Type::isFirstClassType>),
@@ -248,6 +245,9 @@ static bool isSameType(llvm::Type *type1, llvm::Type *type2) {
248
245
  }
249
246
  }
250
247
  } else if (type1->isPointerTy()) {
248
+ if (type1->isOpaquePointerTy() || type2->isOpaquePointerTy()) {
249
+ return type1->isOpaquePointerTy() && type2->isOpaquePointerTy();
250
+ }
251
251
  return isSameType(type1->getPointerElementType(), type2->getPointerElementType());
252
252
  } else if (type1->isStructTy()) {
253
253
  unsigned numElements = type1->getStructNumElements();