[llvm] r273827 - Use isPositionIndependent predicate. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 26 15:24:01 PDT 2016


Author: rafael
Date: Sun Jun 26 17:24:01 2016
New Revision: 273827

URL: http://llvm.org/viewvc/llvm-project?rev=273827&view=rev
Log:
Use isPositionIndependent predicate. NFC.

Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp

Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp?rev=273827&r1=273826&r2=273827&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp Sun Jun 26 17:24:01 2016
@@ -1408,15 +1408,15 @@ HexagonTargetLowering::LowerConstantPool
   EVT ValTy = Op.getValueType();
   ConstantPoolSDNode *CPN = cast<ConstantPoolSDNode>(Op);
   unsigned Align = CPN->getAlignment();
-  Reloc::Model RM = HTM.getRelocationModel();
-  unsigned char TF = (RM == Reloc::PIC_) ? HexagonII::MO_PCREL : 0;
+  bool IsPositionIndependent = isPositionIndependent();
+  unsigned char TF = IsPositionIndependent ? HexagonII::MO_PCREL : 0;
 
   SDValue T;
   if (CPN->isMachineConstantPoolEntry())
     T = DAG.getTargetConstantPool(CPN->getMachineCPVal(), ValTy, Align, TF);
   else
     T = DAG.getTargetConstantPool(CPN->getConstVal(), ValTy, Align, TF);
-  if (RM == Reloc::PIC_)
+  if (IsPositionIndependent)
     return DAG.getNode(HexagonISD::AT_PCREL, SDLoc(Op), ValTy, T);
   return DAG.getNode(HexagonISD::CP, SDLoc(Op), ValTy, T);
 }
@@ -1425,8 +1425,7 @@ SDValue
 HexagonTargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const {
   EVT VT = Op.getValueType();
   int Idx = cast<JumpTableSDNode>(Op)->getIndex();
-  Reloc::Model RM = HTM.getRelocationModel();
-  if (RM == Reloc::PIC_) {
+  if (isPositionIndependent()) {
     SDValue T = DAG.getTargetJumpTable(Idx, VT, HexagonII::MO_PCREL);
     return DAG.getNode(HexagonISD::AT_PCREL, SDLoc(Op), VT, T);
   }
@@ -1593,9 +1592,9 @@ HexagonTargetLowering::LowerToTLSInitial
   // Get the thread pointer.
   SDValue TP = DAG.getCopyFromReg(DAG.getEntryNode(), dl, Hexagon::UGP, PtrVT);
 
-  Reloc::Model RM = HTM.getRelocationModel();
-  unsigned char TF = (RM == Reloc::PIC_) ? HexagonII::MO_IEGOT
-                                         : HexagonII::MO_IE;
+  bool IsPositionIndependent = isPositionIndependent();
+  unsigned char TF =
+      IsPositionIndependent ? HexagonII::MO_IEGOT : HexagonII::MO_IE;
 
   // First generate the TLS symbol address
   SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(), dl, PtrVT,
@@ -1603,7 +1602,7 @@ HexagonTargetLowering::LowerToTLSInitial
 
   SDValue Sym = DAG.getNode(HexagonISD::CONST32, dl, PtrVT, TGA);
 
-  if (RM == Reloc::PIC_) {
+  if (IsPositionIndependent) {
     // Generate the GOT pointer in case of position independent code
     SDValue GOT = LowerGLOBAL_OFFSET_TABLE(Sym, DAG);
 




More information about the llvm-commits mailing list