This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Add support for dllimport of values and functions
ClosedPublic

Authored by mstorsjo on Oct 4 2017, 1:18 AM.

Details

Summary

Previously, the dllimport attribute did the right thing in terms of treating it as a pointer to a value, but this makes sure the names get mangled properly, and calls to such functions load the function from the __imp_ pointer.

This is based on SVN r212431 and r212430 where the same was implemented for ARM.

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 4 2017, 1:18 AM
compnerd accepted this revision.Oct 24 2017, 9:15 PM

Seems fine with the adjustments.

lib/Target/AArch64/AArch64ISelLowering.cpp
3714

Can you lower this to ~L3725.

lib/Target/AArch64/AArch64MCInstLower.cpp
41

Early return please:

if (!TheTriple.isOSBinFormatCOFF())
  return Printer.getSymbol(MO.getGlobal());
...
test/CodeGen/AArch64/dllimport.ll
1

I prefer the canonicalized triple aarch64-unknown-windows-msvc

6

Are the arm_aapcs_vfpcc correct here? The variant of AAPCS64 isn't marked differently I thought. The same through out.

This revision is now accepted and ready to land.Oct 24 2017, 9:15 PM
mstorsjo added inline comments.Oct 24 2017, 11:23 PM
lib/Target/AArch64/AArch64ISelLowering.cpp
3714

Ok, moving all of these three new variables down closer to where they're set and used.

lib/Target/AArch64/AArch64MCInstLower.cpp
41

Sure

test/CodeGen/AArch64/dllimport.ll
1

Ok, will change

6

Indeed, this is just a leftover since I based this on the ARM dllimport test - will remove.

This revision was automatically updated to reflect the committed changes.