Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. Machine CPU: skylake
  2. Machine info: x86_64-pc-windows-msvc
  3.  
  4. struct SomeStruct
  5. {
  6. static double Callback(uint8_t* ptr, double foo) { return foo * 2; }
  7. };
  8.  
  9. define i32 @main(i32, i8**) {
  10. varinit:
  11. // omitted here: initialize %ptr from i8**. This IR code works.
  12.  
  13. %1 = call double @"SomeStruct::Callback"(i8* %ptr, double 2.700000e+01)
  14. ret i32 0
  15. }
  16.  
  17. declare double @"SomeStruct::Callback"(i8*, double)
  18.  
  19. // during initialization of the function
  20. auto function = llvm::Function::Create(functionType, llvm::Function::ExternalLinkage, name, module);
  21. function->setCallingConv(llvm::CallingConv::X86_64_Win64);
  22. ...
  23.  
  24. // during calling of the function
  25. call->setCallingConv(llvm::CallingConv::X86_64_Win64);
  26.  
  27. movq (%rdx), %rcx
  28. vmovss __real@41d80000(%rip), %xmm1
  29. callq "SomeStruct::Callback"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement