summaryrefslogtreecommitdiff
path: root/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/WebAssembly/WebAssemblyRegStackify.cpp')
-rw-r--r--lib/Target/WebAssembly/WebAssemblyRegStackify.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
index 6650191807dcb..ea9e3fa862ce2 100644
--- a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
@@ -170,28 +170,16 @@ static void Query(const MachineInstr &MI, AliasAnalysis &AA, bool &Read,
if (MI.mayStore()) {
Write = true;
- const MachineFunction &MF = *MI.getParent()->getParent();
- if (MF.getSubtarget<WebAssemblySubtarget>()
- .getTargetTriple().isOSBinFormatELF()) {
- // Check for stores to __stack_pointer.
- for (auto MMO : MI.memoperands()) {
- const MachinePointerInfo &MPI = MMO->getPointerInfo();
- if (MPI.V.is<const PseudoSourceValue *>()) {
- auto PSV = MPI.V.get<const PseudoSourceValue *>();
- if (const ExternalSymbolPseudoSourceValue *EPSV =
- dyn_cast<ExternalSymbolPseudoSourceValue>(PSV))
- if (StringRef(EPSV->getSymbol()) == "__stack_pointer")
- StackPointer = true;
- }
- }
- } else {
- // Check for sets of the stack pointer.
- const MachineModuleInfoWasm &MMIW =
- MF.getMMI().getObjFileInfo<MachineModuleInfoWasm>();
- if ((MI.getOpcode() == WebAssembly::SET_LOCAL_I32 ||
- MI.getOpcode() == WebAssembly::SET_LOCAL_I64) &&
- MI.getOperand(0).getImm() == MMIW.getStackPointerGlobal()) {
- StackPointer = true;
+ // Check for stores to __stack_pointer.
+ for (auto MMO : MI.memoperands()) {
+ const MachinePointerInfo &MPI = MMO->getPointerInfo();
+ if (MPI.V.is<const PseudoSourceValue *>()) {
+ auto PSV = MPI.V.get<const PseudoSourceValue *>();
+ if (const ExternalSymbolPseudoSourceValue *EPSV =
+ dyn_cast<ExternalSymbolPseudoSourceValue>(PSV))
+ if (StringRef(EPSV->getSymbol()) == "__stack_pointer") {
+ StackPointer = true;
+ }
}
}
} else if (MI.hasOrderedMemoryRef()) {