summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2016-03-28 17:05:30 +0000
committerDerek Schuff <dschuff@google.com>2016-03-28 17:05:30 +0000
commitad154c837e4428842cfe5c0f9dbfcc42ba7a1454 (patch)
treed2814494f2f8e2c72605d033d9ef6b566fa6e223 /llvm
parent77e2128580e0fdaf6091454d8f04277e8abf74f7 (diff)
downloadbcm5719-llvm-ad154c837e4428842cfe5c0f9dbfcc42ba7a1454.tar.gz
bcm5719-llvm-ad154c837e4428842cfe5c0f9dbfcc42ba7a1454.zip
Introduce MachineFunctionProperties and the AllVRegsAllocated property
MachineFunctionProperties represents a set of properties that a MachineFunction can have at particular points in time. Existing examples of this idea are MachineRegisterInfo::isSSA() and MachineRegisterInfo::tracksLiveness() which will eventually be switched to use this mechanism. This change introduces the AllVRegsAllocated property; i.e. the property that all virtual registers have been allocated and there are no VReg operands left. With this mechanism, passes can declare that they require a particular property to be set, or that they set or clear properties by implementing e.g. MachineFunctionPass::getRequiredProperties(). The MachineFunctionPass base class verifies that the requirements are met, and handles the setting and clearing based on the delcarations. Passes can also directly query and update the current properties of the MF if they want to have conditional behavior. This change annotates the target-independent post-regalloc passes; future changes will also annotate target-specific ones. Reviewers: qcolombet, hfinkel Differential Revision: http://reviews.llvm.org/D18421 llvm-svn: 264593
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/CodeGen/MIRYamlMapping.h3
-rw-r--r--llvm/include/llvm/CodeGen/MachineFunction.h66
-rw-r--r--llvm/include/llvm/CodeGen/MachineFunctionPass.h26
-rw-r--r--llvm/lib/CodeGen/FuncletLayout.cpp4
-rw-r--r--llvm/lib/CodeGen/ImplicitNullChecks.cpp5
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp5
-rw-r--r--llvm/lib/CodeGen/MIRParser/MIRParser.cpp2
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp3
-rw-r--r--llvm/lib/CodeGen/MachineCopyPropagation.cpp5
-rw-r--r--llvm/lib/CodeGen/MachineFunctionPass.cpp13
-rw-r--r--llvm/lib/CodeGen/PostRASchedulerList.cpp5
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp5
-rw-r--r--llvm/lib/CodeGen/RegAllocBasic.cpp5
-rw-r--r--llvm/lib/CodeGen/RegAllocFast.cpp6
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp4
-rw-r--r--llvm/lib/CodeGen/RegAllocPBQP.cpp5
-rw-r--r--llvm/lib/CodeGen/StackMapLivenessAnalysis.cpp5
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp4
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp14
-rw-r--r--llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir4
-rw-r--r--llvm/test/CodeGen/MIR/ARM/sched-it-debug-nodes.mir1
-rw-r--r--llvm/test/CodeGen/X86/machine-copy-prop.mir12
-rw-r--r--llvm/test/DebugInfo/MIR/X86/live-debug-values-3preds.mir1
-rw-r--r--llvm/test/DebugInfo/MIR/X86/live-debug-values.mir1
24 files changed, 201 insertions, 3 deletions
diff --git a/llvm/include/llvm/CodeGen/MIRYamlMapping.h b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
index 14d3744741c..9d5eb60e488 100644
--- a/llvm/include/llvm/CodeGen/MIRYamlMapping.h
+++ b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
@@ -385,6 +385,8 @@ struct MachineFunction {
unsigned Alignment = 0;
bool ExposesReturnsTwice = false;
bool HasInlineAsm = false;
+ // MachineFunctionProperties
+ bool AllVRegsAllocated = false;
// Register information
bool IsSSA = false;
bool TracksRegLiveness = false;
@@ -408,6 +410,7 @@ template <> struct MappingTraits<MachineFunction> {
YamlIO.mapOptional("alignment", MF.Alignment);
YamlIO.mapOptional("exposesReturnsTwice", MF.ExposesReturnsTwice);
YamlIO.mapOptional("hasInlineAsm", MF.HasInlineAsm);
+ YamlIO.mapOptional("allVRegsAllocated", MF.AllVRegsAllocated);
YamlIO.mapOptional("isSSA", MF.IsSSA);
YamlIO.mapOptional("tracksRegLiveness", MF.TracksRegLiveness);
YamlIO.mapOptional("tracksSubRegLiveness", MF.TracksSubRegLiveness);
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index 89b261681b3..e55dc7b454a 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -18,6 +18,7 @@
#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
#define LLVM_CODEGEN_MACHINEFUNCTION_H
+#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/ilist.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/IR/DebugLoc.h"
@@ -88,6 +89,63 @@ struct MachineFunctionInfo {
}
};
+/// Properties which a MachineFunction may have at a given point in time.
+/// Each of these has checking code in the MachineVerifier, and passes can
+/// require that a property be set.
+class MachineFunctionProperties {
+ // TODO: Add MachineVerifier checks for AllVRegsAllocated
+ // TODO: Add a way to print the properties and make more useful error messages
+ // Possible TODO: Allow targets to extend this (perhaps by allowing the
+ // constructor to specify the size of the bit vector)
+ // Possible TODO: Allow requiring the negative (e.g. VRegsAllocated could be
+ // stated as the negative of "has vregs"
+
+ // Stated in "positive" form; i.e. a pass could require that the property
+ // hold, but not that it does not hold.
+ BitVector Properties =
+ BitVector(static_cast<unsigned>(Property::LastProperty));
+
+ public:
+ // Property descriptions:
+ // IsSSA (currently unused, intended to eventually replace
+ // MachineRegisterInfo::isSSA())
+ // TracksLiveness: (currently unsued, intended to eventually replace
+ // MachineRegisterInfo::tracksLiveness())
+ // AllVRegsAllocated: All virtual registers have been allocated; i.e. all
+ // register operands are physical registers.
+ enum class Property : unsigned {
+ IsSSA,
+ TracksLiveness,
+ AllVRegsAllocated,
+ LastProperty,
+ };
+
+ bool hasProperty(Property P) const {
+ return Properties[static_cast<unsigned>(P)];
+ }
+ MachineFunctionProperties &set(Property P) {
+ Properties.set(static_cast<unsigned>(P));
+ return *this;
+ }
+ MachineFunctionProperties &clear(Property P) {
+ Properties.reset(static_cast<unsigned>(P));
+ return *this;
+ }
+ MachineFunctionProperties &set(const MachineFunctionProperties &MFP) {
+ Properties |= MFP.Properties;
+ return *this;
+ }
+ MachineFunctionProperties &clear(const MachineFunctionProperties &MFP) {
+ Properties.reset(MFP.Properties);
+ return *this;
+ }
+ // Returns true if all properties set in V (i.e. required by a pass) are set
+ // in this.
+ bool verifyRequiredProperties(const MachineFunctionProperties &V) const {
+ return !V.Properties.test(Properties);
+ }
+};
+
class MachineFunction {
const Function *Fn;
const TargetMachine &Target;
@@ -154,6 +212,10 @@ class MachineFunction {
/// True if the function includes any inline assembly.
bool HasInlineAsm = false;
+ /// Current high-level properties of the IR of the function (e.g. is in SSA
+ /// form or whether registers have been allocated)
+ MachineFunctionProperties Properties;
+
// Allocation management for pseudo source values.
std::unique_ptr<PseudoSourceValueManager> PSVManager;
@@ -271,6 +333,10 @@ public:
HasInlineAsm = B;
}
+ /// Get the function properties
+ const MachineFunctionProperties &getProperties() const { return Properties; }
+ MachineFunctionProperties &getProperties() { return Properties; }
+
/// getInfo - Keep track of various per-function pieces of information for
/// backends that would like to do so.
///
diff --git a/llvm/include/llvm/CodeGen/MachineFunctionPass.h b/llvm/include/llvm/CodeGen/MachineFunctionPass.h
index 50a1f6e9621..653d1175d04 100644
--- a/llvm/include/llvm/CodeGen/MachineFunctionPass.h
+++ b/llvm/include/llvm/CodeGen/MachineFunctionPass.h
@@ -20,16 +20,24 @@
#define LLVM_CODEGEN_MACHINEFUNCTIONPASS_H
#include "llvm/Pass.h"
+#include "llvm/CodeGen/MachineFunction.h"
namespace llvm {
-class MachineFunction;
-
/// MachineFunctionPass - This class adapts the FunctionPass interface to
/// allow convenient creation of passes that operate on the MachineFunction
/// representation. Instead of overriding runOnFunction, subclasses
/// override runOnMachineFunction.
class MachineFunctionPass : public FunctionPass {
+public:
+ bool doInitialization(Module&) override {
+ // Cache the properties info at module-init time so we don't have to
+ // construct them for every function.
+ RequiredProperties = getRequiredProperties();
+ SetProperties = getSetProperties();
+ ClearedProperties = getClearedProperties();
+ return false;
+ }
protected:
explicit MachineFunctionPass(char &ID) : FunctionPass(ID) {}
@@ -46,7 +54,21 @@ protected:
///
void getAnalysisUsage(AnalysisUsage &AU) const override;
+ virtual MachineFunctionProperties getRequiredProperties() const {
+ return MachineFunctionProperties();
+ }
+ virtual MachineFunctionProperties getSetProperties() const {
+ return MachineFunctionProperties();
+ }
+ virtual MachineFunctionProperties getClearedProperties() const {
+ return MachineFunctionProperties();
+ }
+
private:
+ MachineFunctionProperties RequiredProperties;
+ MachineFunctionProperties SetProperties;
+ MachineFunctionProperties ClearedProperties;
+
/// createPrinterPass - Get a machine function printer pass.
Pass *createPrinterPass(raw_ostream &O,
const std::string &Banner) const override;
diff --git a/llvm/lib/CodeGen/FuncletLayout.cpp b/llvm/lib/CodeGen/FuncletLayout.cpp
index 8b2f505ff02..b16f81c728d 100644
--- a/llvm/lib/CodeGen/FuncletLayout.cpp
+++ b/llvm/lib/CodeGen/FuncletLayout.cpp
@@ -28,6 +28,10 @@ public:
}
bool runOnMachineFunction(MachineFunction &F) override;
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
};
}
diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp
index a413aebac23..2c03f72601c 100644
--- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp
+++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp
@@ -106,6 +106,11 @@ public:
}
bool runOnMachineFunction(MachineFunction &MF) override;
+
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
};
/// \brief Detect re-ordering hazards and dependencies.
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index d3cbac8cc17..28d07bf3895 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -99,6 +99,11 @@ public:
/// information we preserve.
void getAnalysisUsage(AnalysisUsage &AU) const override;
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
/// Print to ostream with a message.
void printVarLocInMBB(const VarLocInMBB &V, const char *msg,
raw_ostream &Out) const;
diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
index cfe3ab33116..fd57c10fb71 100644
--- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp
@@ -285,6 +285,8 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) {
MF.setAlignment(YamlMF.Alignment);
MF.setExposesReturnsTwice(YamlMF.ExposesReturnsTwice);
MF.setHasInlineAsm(YamlMF.HasInlineAsm);
+ if (YamlMF.AllVRegsAllocated)
+ MF.getProperties().set(MachineFunctionProperties::Property::AllVRegsAllocated);
PerFunctionMIParsingState PFS;
if (initializeRegisterInfo(MF, YamlMF, PFS))
return true;
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index eee0c982caa..10013a94ddb 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -171,6 +171,9 @@ void MIRPrinter::print(const MachineFunction &MF) {
YamlMF.Alignment = MF.getAlignment();
YamlMF.ExposesReturnsTwice = MF.exposesReturnsTwice();
YamlMF.HasInlineAsm = MF.hasInlineAsm();
+ YamlMF.AllVRegsAllocated = MF.getProperties().hasProperty(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+
convert(YamlMF, MF.getRegInfo(), MF.getSubtarget().getRegisterInfo());
ModuleSlotTracker MST(MF.getFunction()->getParent());
MST.incorporateFunction(*MF.getFunction());
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 3a6f2b5330e..3fdf16fb630 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -49,6 +49,11 @@ namespace {
bool runOnMachineFunction(MachineFunction &MF) override;
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
private:
void ClobberRegister(unsigned Reg);
void CopyPropagateBlock(MachineBasicBlock &MBB);
diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp
index 1913d99a781..bd0b11a8cb5 100644
--- a/llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -21,11 +21,13 @@
#include "llvm/Analysis/MemoryDependenceAnalysis.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
+#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/StackProtector.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
+
using namespace llvm;
Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O,
@@ -40,7 +42,16 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
return false;
MachineFunction &MF = getAnalysis<MachineFunctionAnalysis>().getMF();
- return runOnMachineFunction(MF);
+ MachineFunctionProperties &MFProps = MF.getProperties();
+
+ assert(MFProps.verifyRequiredProperties(RequiredProperties) &&
+ "Properties required by the pass are not met by the function");
+
+ bool RV = runOnMachineFunction(MF);
+
+ MFProps.set(SetProperties);
+ MFProps.clear(ClearedProperties);
+ return RV;
}
void MachineFunctionPass::getAnalysisUsage(AnalysisUsage &AU) const {
diff --git a/llvm/lib/CodeGen/PostRASchedulerList.cpp b/llvm/lib/CodeGen/PostRASchedulerList.cpp
index bbb4f296434..f60fcbd90de 100644
--- a/llvm/lib/CodeGen/PostRASchedulerList.cpp
+++ b/llvm/lib/CodeGen/PostRASchedulerList.cpp
@@ -96,6 +96,11 @@ namespace {
MachineFunctionPass::getAnalysisUsage(AU);
}
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
bool runOnMachineFunction(MachineFunction &Fn) override;
bool enablePostRAScheduler(
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index f0dc3238257..25b73d9b845 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -59,6 +59,11 @@ public:
void getAnalysisUsage(AnalysisUsage &AU) const override;
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
/// runOnMachineFunction - Insert prolog/epilog code and replace abstract
/// frame indexes with appropriate references.
///
diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp
index cfe367d5115..c9b9b8aae21 100644
--- a/llvm/lib/CodeGen/RegAllocBasic.cpp
+++ b/llvm/lib/CodeGen/RegAllocBasic.cpp
@@ -83,6 +83,11 @@ public:
/// RABasic analysis usage.
void getAnalysisUsage(AnalysisUsage &AU) const override;
+ MachineFunctionProperties getSetProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
void releaseMemory() override;
Spiller &spiller() override { return *SpillerInstance; }
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index 8d7a7213ba0..56a3470edbe 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -52,6 +52,7 @@ namespace {
static char ID;
RAFast() : MachineFunctionPass(ID), StackSlotForVirtReg(-1),
isBulkSpilling(false) {}
+
private:
MachineFunction *MF;
MachineRegisterInfo *MRI;
@@ -159,6 +160,11 @@ namespace {
MachineFunctionPass::getAnalysisUsage(AU);
}
+ MachineFunctionProperties getSetProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
private:
bool runOnMachineFunction(MachineFunction &Fn) override;
void AllocateBasicBlock();
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index b243d4357bd..2e809fa9d1d 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -322,6 +322,10 @@ public:
/// RAGreedy analysis usage.
void getAnalysisUsage(AnalysisUsage &AU) const override;
+ MachineFunctionProperties getSetProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
void releaseMemory() override;
Spiller &spiller() override { return *SpillerInstance; }
void enqueue(LiveInterval *LI) override;
diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp
index d5b0f96e24a..a9ebea0ab47 100644
--- a/llvm/lib/CodeGen/RegAllocPBQP.cpp
+++ b/llvm/lib/CodeGen/RegAllocPBQP.cpp
@@ -106,6 +106,11 @@ public:
/// PBQP analysis usage.
void getAnalysisUsage(AnalysisUsage &au) const override;
+ MachineFunctionProperties getSetProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
/// Perform register allocation
bool runOnMachineFunction(MachineFunction &MF) override;
diff --git a/llvm/lib/CodeGen/StackMapLivenessAnalysis.cpp b/llvm/lib/CodeGen/StackMapLivenessAnalysis.cpp
index 855058358fe..fd571de86de 100644
--- a/llvm/lib/CodeGen/StackMapLivenessAnalysis.cpp
+++ b/llvm/lib/CodeGen/StackMapLivenessAnalysis.cpp
@@ -62,6 +62,11 @@ public:
/// information we preserve.
void getAnalysisUsage(AnalysisUsage &AU) const override;
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
/// \brief Calculate the liveness information for the given machine function.
bool runOnMachineFunction(MachineFunction &MF) override;
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
index c493cf87ed2..19f74e4bcb2 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -223,6 +223,10 @@ void NVPTXPassConfig::addIRPasses() {
disablePass(&PrologEpilogCodeInserterID);
disablePass(&MachineCopyPropagationID);
disablePass(&TailDuplicateID);
+ disablePass(&StackMapLivenessID);
+ disablePass(&LiveDebugValuesID);
+ disablePass(&PostRASchedulerID);
+ disablePass(&FuncletLayoutID);
addPass(createNVVMReflectPass());
if (getOptLevel() != CodeGenOpt::None)
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 2e4ed625fad..ba13c2f97af 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -106,6 +106,8 @@ public:
bool addILPOpts() override;
void addPreRegAlloc() override;
void addPostRegAlloc() override;
+ void addMachineLateOptimization() override;
+ bool addGCPasses() override { return false; }
void addPreEmitPass() override;
};
} // end anonymous namespace
@@ -179,6 +181,9 @@ void WebAssemblyPassConfig::addPostRegAlloc() {
// virtual registers. Consider removing their restrictions and re-enabling
// them.
//
+
+ // Has no asserts of its own, but was not written to handle virtual regs.
+ disablePass(&ShrinkWrapID);
// We use our own PrologEpilogInserter which is very slightly modified to
// tolerate virtual registers.
disablePass(&PrologEpilogCodeInserterID);
@@ -201,11 +206,20 @@ void WebAssemblyPassConfig::addPostRegAlloc() {
addPass(createWebAssemblyPEI());
}
+void WebAssemblyPassConfig::addMachineLateOptimization() {
+ disablePass(&MachineCopyPropagationID);
+ disablePass(&PostRASchedulerID);
+ TargetPassConfig::addMachineLateOptimization();
+}
+
void WebAssemblyPassConfig::addPreEmitPass() {
TargetPassConfig::addPreEmitPass();
// Eliminate multiple-entry loops.
addPass(createWebAssemblyFixIrreducibleControlFlow());
+ disablePass(&FuncletLayoutID);
+ disablePass(&StackMapLivenessID);
+ disablePass(&LiveDebugValuesID);
// Put the CFG in structured form; insert BLOCK and LOOP markers.
addPass(createWebAssemblyCFGStackify());
diff --git a/llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir b/llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir
index 1257948436c..117b6940ac0 100644
--- a/llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir
+++ b/llvm/test/CodeGen/MIR/AArch64/machine-dead-copy.mir
@@ -14,6 +14,7 @@
# CHECK: bb.0:
# CHECK-NOT: %w20 = COPY
name: copyprop1
+allVRegsAllocated: true
body: |
bb.0:
liveins: %w0, %w1
@@ -28,6 +29,7 @@ body: |
# CHECK: bb.0:
# CHECK: %w20 = COPY
name: copyprop2
+allVRegsAllocated: true
body: |
bb.0:
liveins: %w0, %w1
@@ -42,6 +44,7 @@ body: |
# CHECK: bb.0:
# CHECK-NOT: COPY
name: copyprop3
+allVRegsAllocated: true
body: |
bb.0:
liveins: %w0, %w1
@@ -56,6 +59,7 @@ body: |
# CHECK: bb.0:
# CHECK-NOT: COPY
name: copyprop4
+allVRegsAllocated: true
body: |
bb.0:
liveins: %w0, %w1
diff --git a/llvm/test/CodeGen/MIR/ARM/sched-it-debug-nodes.mir b/llvm/test/CodeGen/MIR/ARM/sched-it-debug-nodes.mir
index 5b5750b8d1e..de831ad2a56 100644
--- a/llvm/test/CodeGen/MIR/ARM/sched-it-debug-nodes.mir
+++ b/llvm/test/CodeGen/MIR/ARM/sched-it-debug-nodes.mir
@@ -92,6 +92,7 @@ name: f
alignment: 1
exposesReturnsTwice: false
hasInlineAsm: false
+allVRegsAllocated: true
isSSA: false
tracksRegLiveness: true
tracksSubRegLiveness: false
diff --git a/llvm/test/CodeGen/X86/machine-copy-prop.mir b/llvm/test/CodeGen/X86/machine-copy-prop.mir
index a9b9c57bcc5..ca5139a28c8 100644
--- a/llvm/test/CodeGen/X86/machine-copy-prop.mir
+++ b/llvm/test/CodeGen/X86/machine-copy-prop.mir
@@ -25,6 +25,7 @@
# CHECK-NOT: COPY
# CHECK-NEXT: NOOP implicit %rax, implicit %rdi
name: copyprop_remove_kill0
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rdi
@@ -42,6 +43,7 @@ body: |
# CHECK-NOT: COPY
# CHECK-NEXT: NOOP implicit %rax, implicit %rdi
name: copyprop_remove_kill1
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rdi
@@ -59,6 +61,7 @@ body: |
# CHECK-NOT: COPY
# CHECK-NEXT: NOOP implicit %rax, implicit %rdi
name: copyprop_remove_kill2
+allVRegsAllocated: true
body: |
bb.0:
%ax = COPY %di
@@ -76,6 +79,7 @@ body: |
# CHECK-NOT: COPY
# CHECK-NEXT: NOOP implicit %rax, implicit %rdi
name: copyprop0
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rdi
@@ -92,6 +96,7 @@ body: |
# CHECK-NEXT: NOOP implicit %rax
# CHECK-NEXT: NOOP implicit %rax, implicit %rdi
name: copyprop1
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rdi
@@ -108,6 +113,7 @@ body: |
# CHECK-NOT: %rax = COPY %rdi
# CHECK-NEXT: NOOP implicit %rax, implicit %rdi
name: copyprop2
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rdi
@@ -126,6 +132,7 @@ body: |
# CHECK-NEXT: %rbp = COPY %rax
# CHECK-NEXT: NOOP implicit %rax, implicit %rbp
name: nocopyprop0
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rbp
@@ -143,6 +150,7 @@ body: |
# CHECK-NEXT: %rax = COPY %rbp
# CHECK-NEXT: NOOP implicit %rax, implicit %rbp
name: nocopyprop1
+allVRegsAllocated: true
body: |
bb.0:
%rbp = COPY %rax
@@ -160,6 +168,7 @@ body: |
# CHECK-NEXT: %rax = COPY %rbp
# CHECK-NEXT: NOOP implicit %rax, implicit %rbp
name: nocopyprop2
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rbp
@@ -177,6 +186,7 @@ body: |
# CHECK-NEXT: %rbp = COPY %rax
# CHECK-NEXT: NOOP implicit %rax, implicit %rbp
name: nocopyprop3
+allVRegsAllocated: true
body: |
bb.0:
%rbp = COPY %rax
@@ -193,6 +203,7 @@ body: |
# CHECK-NEXT: %rax = COPY %rip
# CHECK-NEXT: NOOP implicit %rax
name: nocopyprop4
+allVRegsAllocated: true
body: |
bb.0:
%rax = COPY %rip
@@ -208,6 +219,7 @@ body: |
# CHECK-NEXT: %rip = COPY %rax
# CHECK-NEXT: %rip = COPY %rax
name: nocopyprop5
+allVRegsAllocated: true
body: |
bb.0:
%rip = COPY %rax
diff --git a/llvm/test/DebugInfo/MIR/X86/live-debug-values-3preds.mir b/llvm/test/DebugInfo/MIR/X86/live-debug-values-3preds.mir
index b9313d31812..a7f311c4c09 100644
--- a/llvm/test/DebugInfo/MIR/X86/live-debug-values-3preds.mir
+++ b/llvm/test/DebugInfo/MIR/X86/live-debug-values-3preds.mir
@@ -159,6 +159,7 @@ name: add
alignment: 4
exposesReturnsTwice: false
hasInlineAsm: false
+allVRegsAllocated: true
isSSA: false
tracksRegLiveness: true
tracksSubRegLiveness: false
diff --git a/llvm/test/DebugInfo/MIR/X86/live-debug-values.mir b/llvm/test/DebugInfo/MIR/X86/live-debug-values.mir
index 3c72a866810..2c7c6186ef6 100644
--- a/llvm/test/DebugInfo/MIR/X86/live-debug-values.mir
+++ b/llvm/test/DebugInfo/MIR/X86/live-debug-values.mir
@@ -161,6 +161,7 @@ name: main
alignment: 4
exposesReturnsTwice: false
hasInlineAsm: false
+allVRegsAllocated: true
isSSA: false
tracksRegLiveness: true
tracksSubRegLiveness: false
OpenPOWER on IntegriCloud