summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-08-30 20:51:25 +0000
committerTim Northover <tnorthover@apple.com>2016-08-30 20:51:25 +0000
commit7be2d152c2ba083c73a4aa73c527c3537c2a20aa (patch)
tree311bbfe6f70c4120b5a9c03070bf361159647412 /include
parent605a81a85c4c0426b4a59a3a4afeda020eb92316 (diff)
GlobalISel: combine extracts & sequences created for legalization
Legalization ends up creating many G_SEQUENCE/G_EXTRACT pairs which leads to inefficient codegen (even for -O0), so add a quick pass over the function to remove them again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h3
-rw-r--r--include/llvm/CodeGen/GlobalISel/MachineLegalizePass.h5
2 files changed, 7 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h b/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
index 24ab286b51f..aa08d4530cb 100644
--- a/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
+++ b/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
@@ -293,6 +293,7 @@ public:
/// Idxs[0] + N)` of \p Src and similarly for subsequent bit-indexes.
///
/// \pre setBasicBlock or setMI must have been called.
+ /// \pre \p Indices must be in ascending order of bit position.
///
/// \return a MachineInstrBuilder for the newly created instruction.
MachineInstrBuilder buildExtract(ArrayRef<LLT> ResTys,
@@ -311,7 +312,7 @@ public:
/// destination register.
/// \pre The bits defined by each Op (derived from index and scalar size) must
/// not overlap.
- /// \pre Each source operand must have a
+ /// \pre \p Indices must be in ascending order of bit position.
///
/// \return a MachineInstrBuilder for the newly created instruction.
MachineInstrBuilder buildSequence(LLT ResTy, unsigned Res,
diff --git a/include/llvm/CodeGen/GlobalISel/MachineLegalizePass.h b/include/llvm/CodeGen/GlobalISel/MachineLegalizePass.h
index ccdc05a9623..eca06f4612b 100644
--- a/include/llvm/CodeGen/GlobalISel/MachineLegalizePass.h
+++ b/include/llvm/CodeGen/GlobalISel/MachineLegalizePass.h
@@ -26,6 +26,8 @@
namespace llvm {
+class MachineRegisterInfo;
+
class MachineLegalizePass : public MachineFunctionPass {
public:
static char ID;
@@ -55,6 +57,9 @@ public:
MachineFunctionProperties::Property::Legalized);
}
+ bool combineExtracts(MachineInstr &MI, MachineRegisterInfo &MRI,
+ const TargetInstrInfo &TII);
+
bool runOnMachineFunction(MachineFunction &MF) override;
};
} // End namespace llvm.