diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -1002,11 +1002,11 @@ EVT VT = Op.getValueType(); assert(ES->getTargetFlags() == 0 && "Unexpected target flags on generic ExternalSymbolSDNode"); - // Set the TargetFlags to 0x1 which indicates that this is a "function" - // symbol rather than a data symbol. We do this unconditionally even though - // we don't know anything about the symbol other than its name, because all - // external symbols used in target-independent SelectionDAG code are for - // functions. + // Set the TargetFlags to MO_SYMBOL_FUNCTION which indicates that this is a + // "function" symbol rather than a data symbol. We do this unconditionally + // even though we don't know anything about the symbol other than its name, + // because all external symbols used in target-independent SelectionDAG code + // are for functions. return DAG.getNode( WebAssemblyISD::Wrapper, DL, VT, DAG.getTargetExternalSymbol(ES->getSymbol(), VT, diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td @@ -77,12 +77,6 @@ I32:$count)), (ATOMIC_NOTIFY 0, tglobaladdr:$off, I32:$addr, I32:$count)>; -def NotifyPatExternalSym : - Pat<(i32 (int_wasm_atomic_notify (add I32:$addr, - (WebAssemblywrapper texternalsym:$off)), - I32:$count)), - (ATOMIC_NOTIFY 0, texternalsym:$off, I32:$addr, I32:$count)>; - // Select notifys with just a constant offset. def NotifyPatOffsetOnly : Pat<(i32 (int_wasm_atomic_notify imm:$off, I32:$count)), @@ -123,13 +117,6 @@ def : WaitPatGlobalAddr; def : WaitPatGlobalAddr; -class WaitPatExternalSym : - Pat<(i32 (kind (add I32:$addr, (WebAssemblywrapper texternalsym:$off)), - ty:$exp, I64:$timeout)), - (inst 0, texternalsym:$off, I32:$addr, ty:$exp, I64:$timeout)>; -def : WaitPatExternalSym; -def : WaitPatExternalSym; - // Select wait_i32, ATOMIC_WAIT_I32s with just a constant offset. class WaitPatOffsetOnly : Pat<(i32 (kind imm:$off, ty:$exp, I64:$timeout)), @@ -179,9 +166,6 @@ def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; -def : LoadPatExternalSym; -def : LoadPatExternalSym; - // Select loads with just a constant offset. def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; @@ -189,9 +173,6 @@ def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; - } // Predicates = [HasAtomics] // Extending loads. Note that there are only zero-extending atomic loads, no @@ -285,16 +266,6 @@ def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; - // Extending loads with just a constant offset def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; @@ -316,16 +287,6 @@ def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; - } // Predicates = [HasAtomics] //===----------------------------------------------------------------------===// @@ -371,12 +332,6 @@ def : AStorePatGlobalAddr; def : AStorePatGlobalAddr; -class AStorePatExternalSym : - Pat<(kind (add I32:$addr, (WebAssemblywrapper texternalsym:$off)), ty:$val), - (inst 0, texternalsym:$off, I32:$addr, ty:$val)>; -def : AStorePatExternalSym; -def : AStorePatExternalSym; - // Select stores with just a constant offset. class AStorePatOffsetOnly : Pat<(kind imm:$off, ty:$val), (inst 0, imm:$off, (CONST_I32 0), ty:$val)>; @@ -443,12 +398,6 @@ def : AStorePatGlobalAddr; def : AStorePatGlobalAddr; -def : AStorePatExternalSym; -def : AStorePatExternalSym; -def : AStorePatExternalSym; -def : AStorePatExternalSym; -def : AStorePatExternalSym; - // Truncating stores with just a constant offset def : AStorePatOffsetOnly; def : AStorePatOffsetOnly; @@ -580,11 +529,6 @@ ty:$val)), (inst 0, tglobaladdr:$off, I32:$addr, ty:$val)>; -class BinRMWPatExternalSym : - Pat<(ty (kind (add I32:$addr, (WebAssemblywrapper texternalsym:$off)), - ty:$val)), - (inst 0, texternalsym:$off, I32:$addr, ty:$val)>; - // Select binary RMWs with just a constant offset. class BinRMWPatOffsetOnly : Pat<(ty (kind imm:$off, ty:$val)), @@ -612,9 +556,6 @@ def : BinRMWPatGlobalAddr; def : BinRMWPatGlobalAddr; - def : BinRMWPatExternalSym; - def : BinRMWPatExternalSym; - def : BinRMWPatOffsetOnly; def : BinRMWPatOffsetOnly; @@ -723,17 +664,6 @@ def : BinRMWPatGlobalAddr, inst8_64>; def : BinRMWPatGlobalAddr, inst16_64>; - def : BinRMWPatExternalSym, inst8_32>; - def : BinRMWPatExternalSym, inst16_32>; - def : BinRMWPatExternalSym, inst8_64>; - def : BinRMWPatExternalSym, inst16_64>; - def : BinRMWPatExternalSym, inst32_64>; - - def : BinRMWPatExternalSym, inst8_32>; - def : BinRMWPatExternalSym, inst16_32>; - def : BinRMWPatExternalSym, inst8_64>; - def : BinRMWPatExternalSym, inst16_64>; - // Truncating-extending binary RMWs with just a constant offset def : BinRMWPatOffsetOnly, inst8_32>; def : BinRMWPatOffsetOnly, inst16_32>; @@ -849,11 +779,6 @@ ty:$exp, ty:$new)), (inst 0, tglobaladdr:$off, I32:$addr, ty:$exp, ty:$new)>; -class TerRMWPatExternalSym : - Pat<(ty (kind (add I32:$addr, (WebAssemblywrapper texternalsym:$off)), - ty:$exp, ty:$new)), - (inst 0, texternalsym:$off, I32:$addr, ty:$exp, ty:$new)>; - // Select ternary RMWs with just a constant offset. class TerRMWPatOffsetOnly : Pat<(ty (kind imm:$off, ty:$exp, ty:$new)), @@ -881,9 +806,6 @@ def : TerRMWPatGlobalAddr; def : TerRMWPatGlobalAddr; - def : TerRMWPatExternalSym; - def : TerRMWPatExternalSym; - def : TerRMWPatOffsetOnly; def : TerRMWPatOffsetOnly; @@ -984,17 +906,6 @@ def : TerRMWPatGlobalAddr, inst8_64>; def : TerRMWPatGlobalAddr, inst16_64>; - def : TerRMWPatExternalSym, inst8_32>; - def : TerRMWPatExternalSym, inst16_32>; - def : TerRMWPatExternalSym, inst8_64>; - def : TerRMWPatExternalSym, inst16_64>; - def : TerRMWPatExternalSym, inst32_64>; - - def : TerRMWPatExternalSym, inst8_32>; - def : TerRMWPatExternalSym, inst16_32>; - def : TerRMWPatExternalSym, inst8_64>; - def : TerRMWPatExternalSym, inst16_64>; - // Truncating-extending ternary RMWs with just a constant offset def : TerRMWPatOffsetOnly, inst8_32>; def : TerRMWPatOffsetOnly, inst16_32>; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrMemory.td @@ -102,15 +102,6 @@ def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; -class LoadPatExternalSym : - Pat<(ty (kind (add I32:$addr, (WebAssemblywrapper texternalsym:$off)))), - (inst 0, texternalsym:$off, I32:$addr)>; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; - - // Select loads with just a constant offset. class LoadPatOffsetOnly : Pat<(ty (kind imm:$off)), (inst 0, imm:$off, (CONST_I32 0))>; @@ -129,14 +120,6 @@ def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; -class LoadPatExternSymOffOnly : - Pat<(ty (kind (WebAssemblywrapper texternalsym:$off))), - (inst 0, texternalsym:$off, (CONST_I32 0))>; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; - // Extending load. defm LOAD8_S_I32 : WebAssemblyLoad; defm LOAD8_U_I32 : WebAssemblyLoad; @@ -196,18 +179,6 @@ def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; - - // Select extending loads with just a constant offset. def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; @@ -232,17 +203,6 @@ def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; - // Resolve "don't care" extending loads to zero-extending loads. This is // somewhat arbitrary, but zero-extending is conceptually simpler. @@ -269,11 +229,6 @@ def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; -def : LoadPatExternalSym; // Select "don't care" extending loads with just a constant offset. def : LoadPatOffsetOnly; @@ -286,11 +241,6 @@ def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; def : LoadPatGlobalAddrOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; -def : LoadPatExternSymOffOnly; // Defines atomic and non-atomic stores, regular and truncating multiclass WebAssemblyStore { @@ -341,14 +291,6 @@ def : StorePatGlobalAddr; def : StorePatGlobalAddr; -class StorePatExternalSym : - Pat<(kind ty:$val, (add I32:$addr, (WebAssemblywrapper texternalsym:$off))), - (inst 0, texternalsym:$off, I32:$addr, ty:$val)>; -def : StorePatExternalSym; -def : StorePatExternalSym; -def : StorePatExternalSym; -def : StorePatExternalSym; - // Select stores with just a constant offset. class StorePatOffsetOnly : Pat<(kind ty:$val, imm:$off), (inst 0, imm:$off, (CONST_I32 0), ty:$val)>; @@ -365,14 +307,6 @@ def : StorePatGlobalAddrOffOnly; def : StorePatGlobalAddrOffOnly; -class StorePatExternSymOffOnly : - Pat<(kind ty:$val, (WebAssemblywrapper texternalsym:$off)), - (inst 0, texternalsym:$off, (CONST_I32 0), ty:$val)>; -def : StorePatExternSymOffOnly; -def : StorePatExternSymOffOnly; -def : StorePatExternSymOffOnly; -def : StorePatExternSymOffOnly; - // Truncating store. defm STORE8_I32 : WebAssemblyStore; defm STORE16_I32 : WebAssemblyStore; @@ -404,11 +338,6 @@ def : StorePatGlobalAddr; def : StorePatGlobalAddr; def : StorePatGlobalAddr; -def : StorePatExternalSym; -def : StorePatExternalSym; -def : StorePatExternalSym; -def : StorePatExternalSym; -def : StorePatExternalSym; // Select truncating stores with just a constant offset. def : StorePatOffsetOnly; @@ -421,11 +350,6 @@ def : StorePatGlobalAddrOffOnly; def : StorePatGlobalAddrOffOnly; def : StorePatGlobalAddrOffOnly; -def : StorePatExternSymOffOnly; -def : StorePatExternSymOffOnly; -def : StorePatExternSymOffOnly; -def : StorePatExternSymOffOnly; -def : StorePatExternSymOffOnly; // Current memory size. defm MEMORY_SIZE_I32 : I<(outs I32:$dst), (ins i32imm:$flags), diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td @@ -57,10 +57,8 @@ def : LoadPatImmOff("LOAD_"#vec_t)>; def : LoadPatImmOff("LOAD_"#vec_t)>; def : LoadPatGlobalAddr("LOAD_"#vec_t)>; -def : LoadPatExternalSym("LOAD_"#vec_t)>; def : LoadPatOffsetOnly("LOAD_"#vec_t)>; def : LoadPatGlobalAddrOffOnly("LOAD_"#vec_t)>; -def : LoadPatExternSymOffOnly("LOAD_"#vec_t)>; } // Store: v128.store @@ -81,10 +79,8 @@ def : StorePatImmOff("STORE_"#vec_t)>; def : StorePatImmOff("STORE_"#vec_t)>; def : StorePatGlobalAddr("STORE_"#vec_t)>; -def : StorePatExternalSym("STORE_"#vec_t)>; def : StorePatOffsetOnly("STORE_"#vec_t)>; def : StorePatGlobalAddrOffOnly("STORE_"#vec_t)>; -def : StorePatExternSymOffOnly("STORE_"#vec_t)>; } //===----------------------------------------------------------------------===//