From: Ahmed Bougacha Date: Tue, 2 Aug 2016 11:41:03 +0000 (+0000) Subject: [GlobalISel] Const-ify MachineInstrs passed to MachineLegalizer. X-Git-Tag: llvmorg-4.0.0-rc1~13580 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f49ab9af2c776465291db05a7b29b1b7f0f00241;p=platform%2Fupstream%2Fllvm.git [GlobalISel] Const-ify MachineInstrs passed to MachineLegalizer. llvm-svn: 277445 --- diff --git a/llvm/include/llvm/CodeGen/GlobalISel/MachineLegalizer.h b/llvm/include/llvm/CodeGen/GlobalISel/MachineLegalizer.h index 1ba1a75..29398e8 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/MachineLegalizer.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/MachineLegalizer.h @@ -101,7 +101,7 @@ public: /// \returns a pair consisting of the kind of legalization that should be /// performed and the destination type. std::pair getAction(unsigned Opcode, LLT) const; - std::pair getAction(MachineInstr &MI) const; + std::pair getAction(const MachineInstr &MI) const; /// Iterate the given function (typically something like doubling the width) /// on Ty until we find a legal type for this operation. @@ -128,7 +128,7 @@ public: return std::make_pair(Action, findLegalType(Opcode, Ty, Action)); } - bool isLegal(MachineInstr &MI) const; + bool isLegal(const MachineInstr &MI) const; private: typedef DenseMap, LegalizeAction> ActionMap; diff --git a/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp b/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp index 600f7bc..6856ed5 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp +++ b/llvm/lib/CodeGen/GlobalISel/MachineLegalizer.cpp @@ -94,11 +94,11 @@ MachineLegalizer::getAction(unsigned Opcode, LLT Ty) const { } std::pair -MachineLegalizer::getAction(MachineInstr &MI) const { +MachineLegalizer::getAction(const MachineInstr &MI) const { return getAction(MI.getOpcode(), MI.getType()); } -bool MachineLegalizer::isLegal(MachineInstr &MI) const { +bool MachineLegalizer::isLegal(const MachineInstr &MI) const { return getAction(MI).first == Legal; }