[PATCH] D42568: [AArch64] Don't enable GlobalISel automatically for windows

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 01:37:21 PST 2018


mstorsjo created this revision.
mstorsjo added reviewers: aemerson, compnerd.
Herald added subscribers: kristof.beyls, javed.absar, rovka, rengolin.

Calls to dllimport functions don't work properly yet (and an initial brief attempt to fix it wasn't successful).

Use of dllimport variables seem to work fine though, after fixing AArch64SubTarget::ClassifyGlobalReference to return the MO_DLLIMPORT flag where necessary.


https://reviews.llvm.org/D42568

Files:
  lib/CodeGen/GlobalISel/IRTranslator.cpp
  lib/Target/AArch64/AArch64TargetMachine.cpp
  test/CodeGen/AArch64/dllimport.ll


Index: test/CodeGen/AArch64/dllimport.ll
===================================================================
--- test/CodeGen/AArch64/dllimport.ll
+++ test/CodeGen/AArch64/dllimport.ll
@@ -1,5 +1,6 @@
 ; RUN: llc -mtriple aarch64-unknown-windows-msvc -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,DAG-ISEL
 ; RUN: llc -mtriple aarch64-unknown-windows-msvc -fast-isel -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,FAST-ISEL
+; RUN: llc -mtriple aarch64-unknown-windows-msvc -O0 -filetype asm -o - %s | FileCheck %s -check-prefixes=CHECK,FAST-ISEL
 
 @var = external dllimport global i32
 @ext = external global i32
Index: lib/Target/AArch64/AArch64TargetMachine.cpp
===================================================================
--- lib/Target/AArch64/AArch64TargetMachine.cpp
+++ lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -245,7 +245,9 @@
   initAsmInfo();
 
   // Enable GlobalISel at or below EnableGlobalISelAt0.
-  if (getOptLevel() <= EnableGlobalISelAtO)
+  // Don't enable it automatically on Windows, where some vital
+  // concepts (calling of dllimport functions) haven't yet been hooked up.
+  if (getOptLevel() <= EnableGlobalISelAtO && !TT.isOSWindows())
     setGlobalISel(true);
 }
 
Index: lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -817,6 +817,10 @@
   auto TII = MF->getTarget().getIntrinsicInfo();
   const Function *F = CI.getCalledFunction();
 
+  // FIXME: support Windows dllimport function calls.
+  if (F && F->hasDLLImportStorageClass())
+    return false;
+
   if (CI.isInlineAsm())
     return translateInlineAsm(CI, MIRBuilder);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42568.131556.patch
Type: text/x-patch
Size: 1752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180126/84cfffc8/attachment.bin>


More information about the llvm-commits mailing list