[llvm] r227948 - Define a runOnMachineFunction for the Hexagon AsmPrinter and

Eric Christopher echristo at gmail.com
Mon Feb 2 22:40:22 PST 2015


Author: echristo
Date: Tue Feb  3 00:40:22 2015
New Revision: 227948

URL: http://llvm.org/viewvc/llvm-project?rev=227948&view=rev
Log:
Define a runOnMachineFunction for the Hexagon AsmPrinter and
use it to initialize the subtarget.

Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp
    llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.h

Modified: llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp?rev=227948&r1=227947&r2=227948&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp Tue Feb  3 00:40:22 2015
@@ -63,9 +63,7 @@ static cl::opt<bool> AlignCalls(
 
 HexagonAsmPrinter::HexagonAsmPrinter(TargetMachine &TM,
                                      std::unique_ptr<MCStreamer> Streamer)
-    : AsmPrinter(TM, std::move(Streamer)) {
-  Subtarget = &TM.getSubtarget<HexagonSubtarget>();
-}
+    : AsmPrinter(TM, std::move(Streamer)), Subtarget(nullptr) {}
 
 void HexagonAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
                                     raw_ostream &O) {

Modified: llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.h?rev=227948&r1=227947&r2=227948&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.h Tue Feb  3 00:40:22 2015
@@ -28,6 +28,11 @@ namespace llvm {
     explicit HexagonAsmPrinter(TargetMachine &TM,
                                std::unique_ptr<MCStreamer> Streamer);
 
+    bool runOnMachineFunction(MachineFunction &Fn) override {
+      Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
+      return AsmPrinter::runOnMachineFunction(Fn);
+    }
+
     const char *getPassName() const override {
       return "Hexagon Assembly Printer";
     }





More information about the llvm-commits mailing list