[PATCH] D13809: AMDGPU/SI: Emit relocations for constant arrays when targeting HSA

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 13:44:00 PDT 2015


arsenm added inline comments.

================
Comment at: lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp:106
@@ -104,7 +105,3 @@
 
-  // This label is used to mark the end of the .text section.
-  const TargetLoweringObjectFile &TLOF = getObjFileLowering();
-  OutStreamer->SwitchSection(TLOF.getTextSection());
-  MCSymbol *EndOfTextLabel =
-      OutContext.getOrCreateSymbol(StringRef(END_OF_TEXT_LABEL_NAME));
-  OutStreamer->EmitLabel(EndOfTextLabel);
+  if (Triple(M.getTargetTriple()).getOS() != Triple::AMDHSA) {
+    // This label is used to mark the end of the .text section.
----------------
You should be able to get the Triple object from the TargetMachine with TM.getTargetTriple()

================
Comment at: lib/Target/AMDGPU/AMDGPUMCInstLower.cpp:46-49
@@ +45,6 @@
+  switch (RT) {
+  default: return MCSymbolRefExpr::VK_None;
+  case ELF::R_AMDGPU_32_LO: return MCSymbolRefExpr::VK_AMDGPU_32_LO;
+  case ELF::R_AMDGPU_32_HI: return MCSymbolRefExpr::VK_AMDGPU_32_HI;
+  case ELF::R_AMDGPU_64:    return MCSymbolRefExpr::VK_AMDGPU_64;
+  case ELF::R_AMDGPU_INIT_SAMPLER:
----------------
returns on separate lines

================
Comment at: lib/Target/AMDGPU/SIISelLowering.cpp:35-36
@@ -34,3 +34,4 @@
 #include "llvm/IR/Function.h"
+#include "llvm/Support/ELF.h"
 #include "llvm/ADT/SmallString.h"
 
----------------
Out of alphabetical order

================
Comment at: lib/Target/AMDGPU/SIISelLowering.cpp:975-976
@@ +974,4 @@
+  SDLoc DL(GSD);
+
+  if (Subtarget->isAmdHsaOS()) {
+    SDValue Lo = DAG.getTargetGlobalAddress(GV, DL, MVT::i32, GSD->getOffset(),
----------------
A comment about how globals are handled in HSA vs. not would be helpful


http://reviews.llvm.org/D13809





More information about the llvm-commits mailing list