Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bff6a3f
some fixes
ASDAlexander77 Jan 21, 2025
d45d491
progress of fixes
ASDAlexander77 Jan 21, 2025
f6aa13f
progress of fixes to union and null compare
ASDAlexander77 Jan 21, 2025
98ae3b2
more fixes to safe cast and global vars
ASDAlexander77 Jan 21, 2025
eb64c9a
progress of fixes
ASDAlexander77 Jan 21, 2025
9f8d1bf
implemented safe type for field access
ASDAlexander77 Jan 22, 2025
744517d
refactored tests
ASDAlexander77 Jan 22, 2025
53bed7e
fix for safe cast test
ASDAlexander77 Jan 22, 2025
3ca026c
progress of implementing safe type for field access
ASDAlexander77 Jan 22, 2025
18191f3
update test
ASDAlexander77 Jan 22, 2025
dc9ef16
improved safe type for field access
ASDAlexander77 Jan 22, 2025
5a94471
added some code to improve dbg experience
ASDAlexander77 Jan 22, 2025
34e8f46
refactoring
ASDAlexander77 Jan 22, 2025
5f65a21
added test
ASDAlexander77 Jan 22, 2025
4cada8f
added code to support amp amp in safe types
ASDAlexander77 Jan 22, 2025
5375b5a
progress of adding new internal commands
ASDAlexander77 Jan 23, 2025
59b96f9
progress of adding inline asm
ASDAlexander77 Jan 23, 2025
210a1af
finished inline asm
ASDAlexander77 Jan 23, 2025
46d485d
added code for call intrinsic
ASDAlexander77 Jan 24, 2025
2367fb4
added fence command
ASDAlexander77 Jan 24, 2025
3d9853a
added test
ASDAlexander77 Jan 24, 2025
ef9876c
added atomicrmw command
ASDAlexander77 Jan 24, 2025
5134b3b
updated cmpxchg
ASDAlexander77 Jan 24, 2025
218b643
refactoring and implementing atomic vars
ASDAlexander77 Jan 25, 2025
365794f
progress of implementing atomic for vars
ASDAlexander77 Jan 25, 2025
d21858c
added initial atomic attributes
ASDAlexander77 Jan 25, 2025
1753a91
added alignment for load store when atomic
ASDAlexander77 Jan 25, 2025
34add7a
progress of adding attributes to load store
ASDAlexander77 Jan 25, 2025
314d21c
added load store attrs with correct values
ASDAlexander77 Jan 26, 2025
df0fca0
updated build script
ASDAlexander77 Jan 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tag.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
git tag -a v0.0-pre-alpha65 -m "pre alpha v0.0-65"
git tag -a v0.0-pre-alpha66 -m "pre alpha v0.0-66"
git push origin --tags
4 changes: 2 additions & 2 deletions tag_del.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
git push --delete origin v0.0-pre-alpha65
git tag -d v0.0-pre-alpha65
git push --delete origin v0.0-pre-alpha66
git tag -d v0.0-pre-alpha66
77 changes: 69 additions & 8 deletions tsc/include/TypeScript/DOM.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ class VariableDeclarationDOM
using TypePtr = std::shared_ptr<VariableDeclarationDOM>;

VariableDeclarationDOM(StringRef name, mlir::Type type, mlir::Location loc, Expression initValue = undefined)
: name(name), type(type), loc(loc), initValue(initValue), captured(false), ignoreCapturing(false), _using(false), readWrite(false)
: name(name), type(type), loc(loc), initValue(initValue), captured(false), ignoreCapturing(false), _using(false), readWrite(false),
atomic(false), ordering(0), syncscope(StringRef()), volatile_(false),
nonTemporal(false), invariant(false)
{
}

StringRef getName() const
{
return name;
}

const mlir::Type &getType() const
{
return type;
Expand All @@ -51,10 +54,12 @@ class VariableDeclarationDOM
{
type = type_;
}

const mlir::Location &getLoc() const
{
return loc;
}

const Expression &getInitValue() const
{
return initValue;
Expand All @@ -63,41 +68,97 @@ class VariableDeclarationDOM
{
return !!initValue;
}

bool getReadWriteAccess() const
{
return readWrite;
};
}
void setReadWriteAccess(bool value = true)
{
readWrite = value;
};
}

bool getCaptured() const
{
return captured;
};
}
void setCaptured(bool value = true)
{
captured = value;
};
}

bool getIgnoreCapturing()
{
return ignoreCapturing;
};
}
void setIgnoreCapturing(bool value = true)
{
ignoreCapturing = value;
};
}

bool getUsing() const
{
return _using;
};
}
void setUsing(bool value = true)
{
_using = value;
}

void setAtomic(int ordering_, StringRef syncscope_)
{
atomic = true;
ordering = ordering_;
syncscope = syncscope_;
}
bool getAtomic() const
{
return atomic;
}
int getOrdering() const
{
return ordering;
}
StringRef getSyncScope() const
{
return syncscope;
}

bool getVolatile() const
{
return volatile_;
}
void setVolatile(bool value = true)
{
volatile_ = value;
};

bool getNonTemporal() const
{
return nonTemporal;
}
void setNonTemporal(bool value = true)
{
nonTemporal = value;
};

bool getInvariant() const
{
return invariant;
}
void setInvariant(bool value = true)
{
invariant = value;
};

protected:
bool readWrite;
bool atomic;
int ordering;
StringRef syncscope;
bool volatile_;
bool nonTemporal;
bool invariant;
};

class FunctionParamDOM : public VariableDeclarationDOM
Expand Down
6 changes: 6 additions & 0 deletions tsc/include/TypeScript/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#define IDENTIFIER_ATTR_NAME "identifier"
#define BUILTIN_FUNC_ATTR_NAME "__builtin"
#define GENERIC_ATTR_NAME "__generic"
#define ATOMIC_ATTR_NAME "__atomic"
#define ORDERING_ATTR_NAME "__ordering"
#define SYNCSCOPE_ATTR_NAME "__syncscope"
#define VOLATILE_ATTR_NAME "__volatile"
#define NONTEMPORAL_ATTR_NAME "__nontemporal"
#define INVARIANT_ATTR_NAME "__invariant"
#define INSTANCES_COUNT_ATTR_NAME "InstancesCount"
#define RETURN_VARIABLE_NAME ".return"
#define CAPTURED_NAME ".captured"
Expand Down
32 changes: 32 additions & 0 deletions tsc/include/TypeScript/LowerToLLVM/UnaryBinLogicalOrHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,24 @@ mlir::Value LogicOp(Operation *binOp, SyntaxKind op, mlir::Value left, mlir::Typ
else if (isa<mlir_ts::AnyType>(leftType) || isa<mlir_ts::ClassType>(leftType) ||
isa<mlir_ts::OpaqueType>(leftType) || isa<mlir_ts::NullType>(leftType))
{
// in case of UnionType
if (auto unionType = dyn_cast<mlir_ts::UnionType>(rightType))
{
::typescript::MLIRTypeHelper mth(builder.getContext(), compileOptions);
mlir::Type baseType;
if (mth.isUnionTypeNeedsTag(loc, unionType, baseType))
{
auto tagValue = builder.create<LLVM::ExtractValueOp>(loc, llvmtch.typeConverter->convertType(mth.getStringType()), right,
MLIRHelper::getStructIndex(builder, UNION_TAG_INDEX));
auto nullStr = builder.create<mlir_ts::ConstantOp>(loc, mth.getStringType(), builder.getStringAttr("null"));
auto cmpOp = builder.create<mlir_ts::StringCompareOp>(
loc, mth.getBooleanType(), tagValue, nullStr, builder.getI32IntegerAttr((int)op));
return cmpOp;
}

return LogicOp<StdIOpTy, V1, v1, StdFOpTy, V2, v2>(binOp, op, left, baseType, right, rightType, builder, typeConverter, compileOptions);
}

// excluded string
auto intPtrType = llvmtch.getIntPtrType(0);

Expand Down Expand Up @@ -227,7 +245,21 @@ mlir::Value LogicOp(Operation *binOp, SyntaxKind op, mlir::Value left, mlir::Typ
mlir::Type baseType;
if (mth.isUnionTypeNeedsTag(loc, unionType, baseType))
{
// add test to null value
auto isRightNullValue =
right.getDefiningOp<mlir_ts::NullOp>() || right.getDefiningOp<LLVM::ZeroOp>() || matchPattern(right, m_Zero());
if (isRightNullValue)
{
auto tagValue = builder.create<LLVM::ExtractValueOp>(loc, llvmtch.typeConverter->convertType(mth.getStringType()), left,
MLIRHelper::getStructIndex(builder, UNION_TAG_INDEX));
auto nullStr = builder.create<mlir_ts::ConstantOp>(loc, mth.getStringType(), builder.getStringAttr("null"));
auto cmpOp = builder.create<mlir_ts::StringCompareOp>(
loc, mth.getBooleanType(), tagValue, nullStr, builder.getI32IntegerAttr((int)op));
return cmpOp;
}

emitError(loc, "Not applicable logical operator for type: '") << to_print<int>(leftType) << "'";
return mlir::Value();
}

return LogicOp<StdIOpTy, V1, v1, StdFOpTy, V2, v2>(binOp, op, left, baseType, right, rightType, builder, typeConverter, compileOptions);
Expand Down
Loading
Loading