From d796b3e7b80d797efe015f589b9e534220f23b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20D=C3=B6ring?= Date: Sun, 1 Mar 2020 18:57:31 +0100 Subject: [PATCH] remove dead magics part 2 --- compiler/ast.nim | 8 ++++---- compiler/ccgexprs.nim | 5 ----- compiler/semtypes.nim | 6 ------ lib/core/macros.nim | 2 +- lib/system/comparisons.nim | 4 ++-- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index 81ee68fa923ea..3b10a89eaf039 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -639,7 +639,7 @@ type mSwap, mIsNil, mArrToSeq, mNewString, mNewStringOfCap, mParseBiggestFloat, mMove, mWasMoved, mDestroy, - mDefault, mUnown, mAccessEnv, mAccessTypeInfo, mReset, + mDefault, mUnown, mAccessEnv, mReset, mArray, mOpenArray, mRange, mSet, mSeq, mOpt, mVarargs, mRef, mPtr, mVar, mDistinct, mVoid, mTuple, mOrdinal, @@ -647,8 +647,8 @@ type mUInt, mUInt8, mUInt16, mUInt32, mUInt64, mFloat, mFloat32, mFloat64, mFloat128, mBool, mChar, mString, mCstring, - mPointer, mEmptySet, mIntSetBaseType, mNil, mExpr, mStmt, mTypeDesc, - mVoidType, mPNimrodNode, mShared, mGuarded, mLock, mSpawn, mDeepCopy, + mPointer, mNil, mExpr, mStmt, mTypeDesc, + mVoidType, mPNimrodNode, mSpawn, mDeepCopy, mIsMainModule, mCompileDate, mCompileTime, mProcCall, mCpuEndian, mHostOS, mHostCPU, mBuildOS, mBuildCPU, mAppType, mCompileOption, mCompileOptionArg, @@ -661,7 +661,7 @@ type mNIntVal, mNFloatVal, mNSymbol, mNIdent, mNGetType, mNStrVal, mNSetIntVal, mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, mNSetStrVal, mNLineInfo, mNNewNimNode, mNCopyNimNode, mNCopyNimTree, mStrToIdent, mNSigHash, mNSizeOf, - mNBindSym, mLocals, mNCallSite, + mNBindSym, mNCallSite, mEqIdent, mEqNimrodNode, mSameNodeType, mGetImpl, mNGenSym, mNHint, mNWarning, mNError, mInstantiationInfo, mGetTypeInfo, diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 210db5e96e510..111e1053ba5d3 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2273,11 +2273,6 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = of mMove: genMove(p, e, d) of mDestroy: genDestroy(p, e) of mAccessEnv: unaryExpr(p, e, d, "$1.ClE_0") - of mAccessTypeInfo: - var a: TLoc - var dummy: Rope - initLocExpr(p, e[1], a) - putIntoDest(p, d, e, rdMType(p, a, dummy)) of mSlice: localError(p.config, e.info, "invalid context for 'toOpenArray'; " & "'toOpenArray' is only valid within a call expression") diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 61cbecec6806c..abc5de7e8b07d 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1898,10 +1898,6 @@ proc processMagicType(c: PContext, m: PSym) = setMagicIntegral(c.config, m, tyCString, c.config.target.ptrSize) rawAddSon(m.typ, getSysType(c.graph, m.info, tyChar)) of mPointer: setMagicIntegral(c.config, m, tyPointer, c.config.target.ptrSize) - of mEmptySet: - setMagicIntegral(c.config, m, tySet, 1) - rawAddSon(m.typ, newTypeS(tyEmpty, c)) - of mIntSetBaseType: setMagicIntegral(c.config, m, tyRange, c.config.target.intSize) of mNil: setMagicType(c.config, m, tyNil, c.config.target.ptrSize) of mExpr: if m.name.s == "auto": @@ -1937,8 +1933,6 @@ proc processMagicType(c: PContext, m: PSym) = incl m.typ.flags, tfHasAsgn assert c.graph.sysTypes[tySequence] == nil c.graph.sysTypes[tySequence] = m.typ - of mOpt: - setMagicType(c.config, m, tyOpt, szUncomputedSize) of mOrdinal: setMagicIntegral(c.config, m, tyOrdinal, szUncomputedSize) rawAddSon(m.typ, newTypeS(tyNone, c)) diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 31e133090204f..cc20f1dac655a 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -1458,7 +1458,7 @@ proc boolVal*(n: NimNode): bool {.compileTime, noSideEffect.} = else: n == bindSym"true" # hacky solution for now when defined(nimMacrosGetNodeId): - proc nodeID*(n: NimNode): int {.magic: NodeId.} + proc nodeID*(n: NimNode): int {.magic: "NodeId".} ## Returns the id of ``n``, when the compiler has been compiled ## with the flag ``-d:useNodeids``, otherwise returns ``-1``. This ## proc is for the purpose to debug the compiler only. diff --git a/lib/system/comparisons.nim b/lib/system/comparisons.nim index ae6515490f8aa..787820989e93e 100644 --- a/lib/system/comparisons.nim +++ b/lib/system/comparisons.nim @@ -163,12 +163,12 @@ proc `<`*(x, y: int64): bool {.magic: "LtI", noSideEffect.} proc `<=%`*(x, y: IntMax32): bool {.magic: "LeU", noSideEffect.} -proc `<=%`*(x, y: int64): bool {.magic: "LeU", noSideEffect.} +proc `<=%`*(x, y: int64): bool {.magic: "LeU64", noSideEffect.} ## Treats `x` and `y` as unsigned and compares them. ## Returns true if ``unsigned(x) <= unsigned(y)``. proc `<%`*(x, y: IntMax32): bool {.magic: "LtU", noSideEffect.} -proc `<%`*(x, y: int64): bool {.magic: "LtU", noSideEffect.} +proc `<%`*(x, y: int64): bool {.magic: "LtU64", noSideEffect.} ## Treats `x` and `y` as unsigned and compares them. ## Returns true if ``unsigned(x) < unsigned(y)``.