Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ llvm/trunk/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, Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td +++ llvm/trunk/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)), @@ -93,11 +87,6 @@ I32:$count)), (ATOMIC_NOTIFY 0, tglobaladdr:$off, (CONST_I32 0), I32:$count)>; -def NotifyPatExternSymOffOnly : - Pat<(i32 (int_wasm_atomic_notify (WebAssemblywrapper texternalsym:$off), - I32:$count)), - (ATOMIC_NOTIFY 0, texternalsym:$off, (CONST_I32 0), I32:$count)>; - // Select waits with no constant offset. class WaitPatNoOffset : Pat<(i32 (kind I32:$addr, ty:$exp, I64:$timeout)), @@ -123,13 +112,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)), @@ -142,13 +124,6 @@ (inst 0, tglobaladdr:$off, (CONST_I32 0), ty:$exp, I64:$timeout)>; def : WaitPatGlobalAddrOffOnly; def : WaitPatGlobalAddrOffOnly; - -class WaitPatExternSymOffOnly : - Pat<(i32 (kind (WebAssemblywrapper texternalsym:$off), ty:$exp, - I64:$timeout)), - (inst 0, texternalsym:$off, (CONST_I32 0), ty:$exp, I64:$timeout)>; -def : WaitPatExternSymOffOnly; -def : WaitPatExternSymOffOnly; } // Predicates = [HasAtomics] //===----------------------------------------------------------------------===// @@ -179,9 +154,6 @@ def : LoadPatGlobalAddr; def : LoadPatGlobalAddr; -def : LoadPatExternalSym; -def : LoadPatExternalSym; - // Select loads with just a constant offset. def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; @@ -189,9 +161,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 +254,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 +275,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 +320,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)>; @@ -389,12 +332,6 @@ def : AStorePatGlobalAddrOffOnly; def : AStorePatGlobalAddrOffOnly; -class AStorePatExternSymOffOnly : - Pat<(kind (WebAssemblywrapper texternalsym:$off), ty:$val), - (inst 0, texternalsym:$off, (CONST_I32 0), ty:$val)>; -def : AStorePatExternSymOffOnly; -def : AStorePatExternSymOffOnly; - } // Predicates = [HasAtomics] // Truncating stores. @@ -443,12 +380,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; @@ -462,12 +393,6 @@ def : AStorePatGlobalAddrOffOnly; def : AStorePatGlobalAddrOffOnly; -def : AStorePatExternSymOffOnly; -def : AStorePatExternSymOffOnly; -def : AStorePatExternSymOffOnly; -def : AStorePatExternSymOffOnly; -def : AStorePatExternSymOffOnly; - } // Predicates = [HasAtomics] //===----------------------------------------------------------------------===// @@ -580,11 +505,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)), @@ -594,10 +514,6 @@ Pat<(ty (kind (WebAssemblywrapper tglobaladdr:$off), ty:$val)), (inst 0, tglobaladdr:$off, (CONST_I32 0), ty:$val)>; -class BinRMWPatExternSymOffOnly : - Pat<(ty (kind (WebAssemblywrapper texternalsym:$off), ty:$val)), - (inst 0, texternalsym:$off, (CONST_I32 0), ty:$val)>; - // Patterns for various addressing modes. multiclass BinRMWPattern { @@ -612,17 +528,11 @@ def : BinRMWPatGlobalAddr; def : BinRMWPatGlobalAddr; - def : BinRMWPatExternalSym; - def : BinRMWPatExternalSym; - def : BinRMWPatOffsetOnly; def : BinRMWPatOffsetOnly; def : BinRMWPatGlobalAddrOffOnly; def : BinRMWPatGlobalAddrOffOnly; - - def : BinRMWPatExternSymOffOnly; - def : BinRMWPatExternSymOffOnly; } let Predicates = [HasAtomics] in { @@ -723,17 +633,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>; @@ -756,17 +655,6 @@ def : BinRMWPatGlobalAddrOffOnly, inst16_32>; def : BinRMWPatGlobalAddrOffOnly, inst8_64>; def : BinRMWPatGlobalAddrOffOnly, inst16_64>; - - def : BinRMWPatExternSymOffOnly, inst8_32>; - def : BinRMWPatExternSymOffOnly, inst16_32>; - def : BinRMWPatExternSymOffOnly, inst8_64>; - def : BinRMWPatExternSymOffOnly, inst16_64>; - def : BinRMWPatExternSymOffOnly, inst32_64>; - - def : BinRMWPatExternSymOffOnly, inst8_32>; - def : BinRMWPatExternSymOffOnly, inst16_32>; - def : BinRMWPatExternSymOffOnly, inst8_64>; - def : BinRMWPatExternSymOffOnly, inst16_64>; } let Predicates = [HasAtomics] in { @@ -849,11 +737,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)), @@ -863,10 +746,6 @@ Pat<(ty (kind (WebAssemblywrapper tglobaladdr:$off), ty:$exp, ty:$new)), (inst 0, tglobaladdr:$off, (CONST_I32 0), ty:$exp, ty:$new)>; -class TerRMWPatExternSymOffOnly : - Pat<(ty (kind (WebAssemblywrapper texternalsym:$off), ty:$exp, ty:$new)), - (inst 0, texternalsym:$off, (CONST_I32 0), ty:$exp, ty:$new)>; - // Patterns for various addressing modes. multiclass TerRMWPattern { @@ -881,17 +760,11 @@ def : TerRMWPatGlobalAddr; def : TerRMWPatGlobalAddr; - def : TerRMWPatExternalSym; - def : TerRMWPatExternalSym; - def : TerRMWPatOffsetOnly; def : TerRMWPatOffsetOnly; def : TerRMWPatGlobalAddrOffOnly; def : TerRMWPatGlobalAddrOffOnly; - - def : TerRMWPatExternSymOffOnly; - def : TerRMWPatExternSymOffOnly; } let Predicates = [HasAtomics] in @@ -984,17 +857,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>; @@ -1017,17 +879,6 @@ def : TerRMWPatGlobalAddrOffOnly, inst16_32>; def : TerRMWPatGlobalAddrOffOnly, inst8_64>; def : TerRMWPatGlobalAddrOffOnly, inst16_64>; - - def : TerRMWPatExternSymOffOnly, inst8_32>; - def : TerRMWPatExternSymOffOnly, inst16_32>; - def : TerRMWPatExternSymOffOnly, inst8_64>; - def : TerRMWPatExternSymOffOnly, inst16_64>; - def : TerRMWPatExternSymOffOnly, inst32_64>; - - def : TerRMWPatExternSymOffOnly, inst8_32>; - def : TerRMWPatExternSymOffOnly, inst16_32>; - def : TerRMWPatExternSymOffOnly, inst8_64>; - def : TerRMWPatExternSymOffOnly, inst16_64>; } let Predicates = [HasAtomics] in Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td +++ llvm/trunk/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), Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td +++ llvm/trunk/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)>; } //===----------------------------------------------------------------------===//