summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2017-02-22 12:59:47 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2017-02-22 12:59:47 +0000
commit5a7e0f835747a084be476c39e6cf322e3ae51409 (patch)
treecea7c84076e36d6ce4ae5cec975f6194828ad10b /llvm/lib
parent2e0031b37162804d6a3b6a01d2e425027f094103 (diff)
downloadbcm5719-llvm-5a7e0f835747a084be476c39e6cf322e3ae51409.tar.gz
bcm5719-llvm-5a7e0f835747a084be476c39e6cf322e3ae51409.zip
[GlobalISel] Fix compiler warnings and make assert assert something.
llvm-svn: 295827
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86InstructionSelector.cpp12
-rw-r--r--llvm/lib/Target/X86/X86InstructionSelector.h4
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.cpp2
3 files changed, 7 insertions, 11 deletions
diff --git a/llvm/lib/Target/X86/X86InstructionSelector.cpp b/llvm/lib/Target/X86/X86InstructionSelector.cpp
index 9b21ce41e05..cc9fae540c7 100644
--- a/llvm/lib/Target/X86/X86InstructionSelector.cpp
+++ b/llvm/lib/Target/X86/X86InstructionSelector.cpp
@@ -37,10 +37,9 @@ using namespace llvm;
#include "X86GenGlobalISel.inc"
-X86InstructionSelector::X86InstructionSelector(const X86TargetMachine &TM,
- const X86Subtarget &STI,
+X86InstructionSelector::X86InstructionSelector(const X86Subtarget &STI,
const X86RegisterBankInfo &RBI)
- : InstructionSelector(), TM(TM), STI(STI), TII(*STI.getInstrInfo()),
+ : InstructionSelector(), TII(*STI.getInstrInfo()),
TRI(*STI.getRegisterInfo()), RBI(RBI) {}
// FIXME: This should be target-independent, inferred from the types declared
@@ -70,6 +69,7 @@ static bool selectCopy(MachineInstr &I, const TargetInstrInfo &TII,
const RegisterBank &RegBank = *RBI.getRegBank(DstReg, MRI, TRI);
const unsigned DstSize = MRI.getType(DstReg).getSizeInBits();
+ (void)DstSize;
unsigned SrcReg = I.getOperand(1).getReg();
const unsigned SrcSize = RBI.getSizeInBits(SrcReg, MRI, TRI);
(void)SrcSize;
@@ -124,10 +124,8 @@ bool X86InstructionSelector::select(MachineInstr &I) const {
return true;
}
- if (I.getNumOperands() != I.getNumExplicitOperands()) {
- assert("Generic instruction has unexpected implicit operands\n");
- return false;
- }
+ assert(I.getNumOperands() == I.getNumExplicitOperands() &&
+ "Generic instruction has unexpected implicit operands\n");
return selectImpl(I);
}
diff --git a/llvm/lib/Target/X86/X86InstructionSelector.h b/llvm/lib/Target/X86/X86InstructionSelector.h
index 0a8ea3d5304..774fce1efb5 100644
--- a/llvm/lib/Target/X86/X86InstructionSelector.h
+++ b/llvm/lib/Target/X86/X86InstructionSelector.h
@@ -25,7 +25,7 @@ class X86TargetMachine;
class X86InstructionSelector : public InstructionSelector {
public:
- X86InstructionSelector(const X86TargetMachine &TM, const X86Subtarget &STI,
+ X86InstructionSelector(const X86Subtarget &STI,
const X86RegisterBankInfo &RBI);
bool select(MachineInstr &I) const override;
@@ -35,8 +35,6 @@ private:
/// the patterns that don't require complex C++.
bool selectImpl(MachineInstr &I) const;
- const X86TargetMachine &TM;
- const X86Subtarget &STI;
const X86InstrInfo &TII;
const X86RegisterInfo &TRI;
const X86RegisterBankInfo &RBI;
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 3f61cd8ccee..d2a3b269ea8 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -284,7 +284,7 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
auto *RBI = new X86RegisterBankInfo(*I->getRegisterInfo());
GISel->RegBankInfo.reset(RBI);
- GISel->InstSelector.reset(new X86InstructionSelector(*this, *I, *RBI));
+ GISel->InstSelector.reset(new X86InstructionSelector(*I, *RBI));
#endif
I->setGISelAccessor(*GISel);
OpenPOWER on IntegriCloud