[PATCH] D54343: [llvm-exegesis][NFC] Some code style cleanup

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 11 23:39:59 PST 2018


gchatelet added inline comments.


================
Comment at: llvm/tools/llvm-exegesis/lib/X86/Target.cpp:333
   static constexpr const unsigned kF80Bytes = 10; // 80 bits.
-
   ConstantInliner &add(const llvm::MCInst &Inst) {
     Instructions.push_back(Inst);
----------------
newline between constant and functions.


================
Comment at: llvm/tools/llvm-exegesis/lib/X86/Target.cpp:337
   }
-
-  void initStack(unsigned Bytes) {
-    assert(Constant_.getBitWidth() <= Bytes * 8 &&
-           "Value does not have the correct size");
-    const llvm::APInt WideConstant = Constant_.getBitWidth() < Bytes * 8
-                                         ? Constant_.sext(Bytes * 8)
-                                         : Constant_;
-    add(allocateStackSpace(Bytes));
-    size_t ByteOffset = 0;
-    for (; Bytes - ByteOffset >= 4; ByteOffset += 4)
-      add(fillStackSpace(
-          llvm::X86::MOV32mi, ByteOffset,
-          WideConstant.extractBits(32, ByteOffset * 8).getZExtValue()));
-    if (Bytes - ByteOffset >= 2) {
-      add(fillStackSpace(
-          llvm::X86::MOV16mi, ByteOffset,
-          WideConstant.extractBits(16, ByteOffset * 8).getZExtValue()));
-      ByteOffset += 2;
-    }
-    if (Bytes - ByteOffset >= 1)
-      add(fillStackSpace(
-          llvm::X86::MOV8mi, ByteOffset,
-          WideConstant.extractBits(8, ByteOffset * 8).getZExtValue()));
-  }
-
+  void initStack(unsigned Bytes);
   llvm::APInt Constant_;
----------------
newline between functions.


================
Comment at: llvm/tools/llvm-exegesis/lib/X86/Target.cpp:338
+  void initStack(unsigned Bytes);
   llvm::APInt Constant_;
   std::vector<llvm::MCInst> Instructions;
----------------
newline between functions and members.


================
Comment at: llvm/tools/llvm-exegesis/lib/X86/Target.cpp:420
 private:
-  void addTargetSpecificPasses(llvm::PassManagerBase &PM) const override {
-    // Lowers FP pseudo-instructions, e.g. ABS_Fp32 -> ABS_F.
-    PM.add(llvm::createX86FloatingPointStackifierPass());
-  }
-
-  unsigned getScratchMemoryRegister(const llvm::Triple &TT) const override {
-    if (!TT.isArch64Bit()) {
-      // FIXME: This would require popping from the stack, so we would have to
-      // add some additional setup code.
-      return 0;
-    }
-    return TT.isOSWindows() ? llvm::X86::RCX : llvm::X86::RDI;
-  }
-
+  void addTargetSpecificPasses(llvm::PassManagerBase &PM) const override;
+  unsigned getScratchMemoryRegister(const llvm::Triple &TT) const override;
----------------
newline between functions.


================
Comment at: llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp:1
+//===-- TargetTest.cpp ------------------------------------------*- C++ -*-===//
+//
----------------
Thx!


Repository:
  rL LLVM

https://reviews.llvm.org/D54343





More information about the llvm-commits mailing list