diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2016-08-02 11:41:16 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2016-08-02 11:41:16 +0000 |
commit | 45eb3b94d4e1327a9538fdb9536abc6659626928 (patch) | |
tree | 8606f2d9632d43cbf202b884140e193e953302c0 | |
parent | faf8e9f8c65a4ad8577189688dd373f124f7052f (diff) | |
download | bcm5719-llvm-45eb3b94d4e1327a9538fdb9536abc6659626928.tar.gz bcm5719-llvm-45eb3b94d4e1327a9538fdb9536abc6659626928.zip |
[GlobalISel] Don't RegBankSelect target-specific instructions.
They don't have types and should be using register classes.
llvm-svn: 277447
-rw-r--r-- | llvm/include/llvm/Target/TargetOpcodes.h | 5 | ||||
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | 8 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir | 27 |
3 files changed, 39 insertions, 1 deletions
diff --git a/llvm/include/llvm/Target/TargetOpcodes.h b/llvm/include/llvm/Target/TargetOpcodes.h index f06af0f0230..33df133a4d5 100644 --- a/llvm/include/llvm/Target/TargetOpcodes.h +++ b/llvm/include/llvm/Target/TargetOpcodes.h @@ -32,6 +32,11 @@ static inline bool isPreISelGenericOpcode(unsigned Opcode) { return Opcode >= TargetOpcode::PRE_ISEL_GENERIC_OPCODE_START && Opcode <= TargetOpcode::PRE_ISEL_GENERIC_OPCODE_END; } + +/// Check whether the given Opcode is a target-specific opcode. +static inline bool isTargetSpecificOpcode(unsigned Opcode) { + return Opcode > TargetOpcode::PRE_ISEL_GENERIC_OPCODE_END; +} } // end namespace llvm #endif diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp index 521bb795682..6248ab46097 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp @@ -554,7 +554,13 @@ bool RegBankSelect::runOnMachineFunction(MachineFunction &MF) { MII != End;) { // MI might be invalidated by the assignment, so move the // iterator before hand. - assignInstr(*MII++); + MachineInstr &MI = *MII++; + + // Ignore target-specific instructions: they should use proper regclasses. + if (isTargetSpecificOpcode(MI.getOpcode())) + continue; + + assignInstr(MI); } } OptMode = SaveOptMode; diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir index 6eccd085858..76fe671850b 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-regbankselect.mir @@ -54,6 +54,8 @@ entry: ret void } + + define void @ignoreTargetSpecificInst() { ret void } ... --- @@ -327,3 +329,28 @@ body: | %1(64) = COPY %x1 %2(64) = G_OR <2 x s32> %0, %1 ... + +--- +# CHECK-LABEL: name: ignoreTargetSpecificInst +name: ignoreTargetSpecificInst +isSSA: true +# CHECK: registers: +# CHECK-NEXT: - { id: 0, class: gpr64 } +# CHECK-NEXT: - { id: 1, class: gpr64 } +registers: + - { id: 0, class: gpr64 } + - { id: 1, class: gpr64 } +body: | + bb.0: + liveins: %x0 + + ; CHECK: %0 = COPY %x0 + ; CHECK-NEXT: %1 = ADDXrr %0, %0 + ; CHECK-NEXT: %x0 = COPY %1 + ; CHECK-NEXT: RET_ReallyLR implicit %x0 + + %0 = COPY %x0 + %1 = ADDXrr %0, %0 + %x0 = COPY %1 + RET_ReallyLR implicit %x0 +... |