LLT() has a particular meaning: it's one invalid type. But we really
want selected instructions to have no type whatsoever.
Also verify that types don't linger after ISel, and enable the verifier
on the AArch64 select test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277001
91177308-0d34-0410-b5e6-
96231b3b80d8
void setType(LLT Ty, unsigned Idx = 0);
LLT getType(int unsigned = 0) const;
unsigned getNumTypes() const;
+ void removeTypes();
/// Return true if MI is in a bundle (but not the first MI in a bundle).
///
LLT MachineInstr::getType(unsigned Idx) const { return LLT{}; }
+void MachineInstr::removeTypes() {}
+
#else
unsigned MachineInstr::getNumTypes() const { return Tys.size(); }
}
LLT MachineInstr::getType(unsigned Idx) const { return Tys[Idx]; }
+
+void MachineInstr::removeTypes() {
+ Tys.clear();
+}
#endif // LLVM_BUILD_GLOBAL_ISEL
/// RemoveRegOperandsFromUseLists - Unlink all of the register operands in
}
}
+ // Check types.
+ const unsigned NumTypes = MI->getNumTypes();
+ if (isPreISelGenericOpcode(MCID.getOpcode())) {
+ if (NumTypes == 0)
+ report("Generic instruction must have a type", MI);
+ } else {
+ if (NumTypes != 0)
+ report("Non-generic instruction cannot have a type", MI);
+ }
+
StringRef ErrorInfo;
if (!TII->verifyInstruction(*MI, ErrorInfo))
report(ErrorInfo.data(), MI);
I.setDesc(TII.get(NewOpc));
// FIXME: Should the type be always reset in setDesc?
- I.setType(LLT());
+ I.removeTypes();
// Now that we selected an opcode, we need to constrain the register
// operands to use appropriate classes.
-# RUN: llc -O0 -run-pass=instruction-select -global-isel %s -o - | FileCheck %s
+# RUN: llc -O0 -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s
# REQUIRES: global-isel
# Test the instruction selector.
--- |
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
- target triple = "aarch64-apple-ios"
+ target triple = "aarch64--"
define void @add_s32_gpr() { ret void }
define void @add_s64_gpr() { ret void }