[llvm] r270282 - [lanai] Change reloc to use PIC_ by default and cleanup.

Jacques Pienaar via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 14:41:54 PDT 2016


Author: jpienaar
Date: Fri May 20 16:41:53 2016
New Revision: 270282

URL: http://llvm.org/viewvc/llvm-project?rev=270282&view=rev
Log:
[lanai] Change reloc to use PIC_ by default and cleanup.

* Change reloc to PIC_;
* Cleanup (clang-format & modify test);


Modified:
    llvm/trunk/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp
    llvm/trunk/lib/Target/Lanai/LanaiAsmPrinter.cpp
    llvm/trunk/lib/Target/Lanai/LanaiDelaySlotFiller.cpp
    llvm/trunk/lib/Target/Lanai/LanaiRegisterInfo.cpp
    llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp
    llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp
    llvm/trunk/test/CodeGen/Lanai/mem_alu_combiner.ll

Modified: llvm/trunk/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp?rev=270282&r1=270281&r2=270282&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/InstPrinter/LanaiInstPrinter.cpp Fri May 20 16:41:53 2016
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Lanai.h"
 #include "LanaiInstPrinter.h"
+#include "Lanai.h"
 #include "MCTargetDesc/LanaiMCExpr.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCExpr.h"
@@ -138,7 +138,8 @@ bool LanaiInstPrinter::printAlias(const
 void LanaiInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
                                  StringRef Annotation,
                                  const MCSubtargetInfo &STI) {
-  if (!printAlias(MI, OS) && !printAliasInstr(MI, OS)) printInstruction(MI, OS);
+  if (!printAlias(MI, OS) && !printAliasInstr(MI, OS))
+    printInstruction(MI, OS);
   printAnnotation(OS, Annotation);
 }
 
@@ -210,9 +211,11 @@ static void printMemoryBaseRegister(raw_
                                     const MCOperand &RegOp) {
   assert(RegOp.isReg() && "Register operand expected");
   OS << "[";
-  if (LPAC::isPreOp(AluCode)) OS << "*";
+  if (LPAC::isPreOp(AluCode))
+    OS << "*";
   OS << "%" << LanaiInstPrinter::getRegisterName(RegOp.getReg());
-  if (LPAC::isPostOp(AluCode)) OS << "*";
+  if (LPAC::isPostOp(AluCode))
+    OS << "*";
   OS << "]";
 }
 
@@ -254,9 +257,11 @@ void LanaiInstPrinter::printMemRrOperand
 
   // [ Base OP Offset ]
   OS << "[";
-  if (LPAC::isPreOp(AluCode)) OS << "*";
+  if (LPAC::isPreOp(AluCode))
+    OS << "*";
   OS << "%" << getRegisterName(RegOp.getReg());
-  if (LPAC::isPostOp(AluCode)) OS << "*";
+  if (LPAC::isPostOp(AluCode))
+    OS << "*";
   OS << " " << LPAC::lanaiAluCodeToString(AluCode) << " ";
   OS << "%" << getRegisterName(OffsetOp.getReg());
   OS << "]";

Modified: llvm/trunk/lib/Target/Lanai/LanaiAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiAsmPrinter.cpp?rev=270282&r1=270281&r2=270282&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiAsmPrinter.cpp Fri May 20 16:41:53 2016
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Lanai.h"
 #include "InstPrinter/LanaiInstPrinter.h"
+#include "Lanai.h"
 #include "LanaiInstrInfo.h"
 #include "LanaiMCInstLower.h"
 #include "LanaiTargetMachine.h"

Modified: llvm/trunk/lib/Target/Lanai/LanaiDelaySlotFiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiDelaySlotFiller.cpp?rev=270282&r1=270281&r2=270282&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiDelaySlotFiller.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiDelaySlotFiller.cpp Fri May 20 16:41:53 2016
@@ -249,7 +249,8 @@ void Filler::insertDefsUses(MachineBasic
   // be inserted in the delay slot of a call/return as these instructions are
   // expanded to multiple instructions with SP modified before the branch that
   // has the delay slot.
-  if (MI->isCall() || MI->isReturn()) RegDefs.insert(Lanai::SP);
+  if (MI->isCall() || MI->isReturn())
+    RegDefs.insert(Lanai::SP);
 }
 
 // Returns true if the Reg or its alias is in the RegSet.

Modified: llvm/trunk/lib/Target/Lanai/LanaiRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiRegisterInfo.cpp?rev=270282&r1=270281&r2=270282&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiRegisterInfo.cpp Fri May 20 16:41:53 2016
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Lanai.h"
 #include "LanaiRegisterInfo.h"
+#include "Lanai.h"
 #include "LanaiSubtarget.h"
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/STLExtras.h"
@@ -31,8 +31,7 @@
 
 using namespace llvm;
 
-LanaiRegisterInfo::LanaiRegisterInfo()
-    : LanaiGenRegisterInfo(Lanai::RCA) {}
+LanaiRegisterInfo::LanaiRegisterInfo() : LanaiGenRegisterInfo(Lanai::RCA) {}
 
 const uint16_t *
 LanaiRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {

Modified: llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp?rev=270282&r1=270281&r2=270282&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiTargetMachine.cpp Fri May 20 16:41:53 2016
@@ -18,8 +18,8 @@
 #include "LanaiTargetTransformInfo.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/CodeGen/Passes.h"
-#include "llvm/CodeGen/TargetPassConfig.h"
 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
+#include "llvm/CodeGen/TargetPassConfig.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Target/TargetOptions.h"
@@ -50,7 +50,7 @@ static std::string computeDataLayout(con
 static Reloc::Model getEffectiveRelocModel(const Triple &TT,
                                            Optional<Reloc::Model> RM) {
   if (!RM.hasValue())
-    return Reloc::Static;
+    return Reloc::PIC_;
   return *RM;
 }
 

Modified: llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp?rev=270282&r1=270281&r2=270282&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp Fri May 20 16:41:53 2016
@@ -106,8 +106,8 @@ LanaiTargetObjectFile::SelectSectionForG
 }
 
 /// Return true if this constant should be placed into small data section.
-bool LanaiTargetObjectFile::isConstantInSmallSection(
-    const DataLayout &DL, const Constant *CN) const {
+bool LanaiTargetObjectFile::isConstantInSmallSection(const DataLayout &DL,
+                                                     const Constant *CN) const {
   return isInSmallSection(DL.getTypeAllocSize(CN->getType()));
 }
 

Modified: llvm/trunk/test/CodeGen/Lanai/mem_alu_combiner.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Lanai/mem_alu_combiner.ll?rev=270282&r1=270281&r2=270282&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Lanai/mem_alu_combiner.ll (original)
+++ llvm/trunk/test/CodeGen/Lanai/mem_alu_combiner.ll Fri May 20 16:41:53 2016
@@ -3,11 +3,11 @@
 ; RUN:   FileCheck %s -check-prefix=CHECK-DIS
 
 ; CHECK-LABEL: sum,
-; CHECK: ++],
+; CHECK: ld [%r{{[0-9]+}}++], %r{{[0-9]+}}{{$}}
 ; CHECK-DIS-LABEL: sum,
 ; CHECK-DIS-NOT: ++],
 
-define i32 @sum(i32* inreg nocapture readonly %data, i32 inreg %n) #0 {
+define i32 @sum(i32* inreg nocapture readonly %data, i32 inreg %n) {
 entry:
   %cmp6 = icmp sgt i32 %n, 0
   br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup
@@ -27,14 +27,9 @@ for.body:
   %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
   %sum_.07 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
   %arrayidx = getelementptr inbounds i32, i32* %data, i32 %i.08
-  %0 = load i32, i32* %arrayidx, align 4, !tbaa !0
+  %0 = load i32, i32* %arrayidx, align 4
   %add = add nsw i32 %0, %sum_.07
   %inc = add nuw nsw i32 %i.08, 1
   %exitcond = icmp eq i32 %inc, %n
   br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body
 }
-
-!0 = !{!1, !1, i64 0}
-!1 = !{!"int", !2, i64 0}
-!2 = !{!"omnipotent char", !3, i64 0}
-!3 = !{!"Simple C/C++ TBAA"}




More information about the llvm-commits mailing list