Skip to content

Commit

Permalink
some fixes to Debug Information Generation (#131)
Browse files Browse the repository at this point in the history
* cleanup of build scripts

* added fix to process debug info before typeconversion

* fixed issue with using stream when file is not provided

* cleanup

* progress

* fixes

* final fix

* fix

* some fixes

* more fixes

* more fixes

* more fixes

* more fixes

* more fixes

* progress of fixes

* some refactoring

* progress

* final fix for nested scopes

* added fix for DI return types

* progress of improving DI

* added namespace

* progress of fixes for DI

* fixed column location in di

* added arg number to params

* progress

* added more types

* progress

* more fixes

* more fixes

* progress

* updated build scripts

* added some fixes

* more fixes

* progress

* added LLVM_SYMBOLIZER_PATH to test run

* added more envs

* some fixes

* fixing path

* update

* more fixes

* more fixes

* final fix

* cleanup

* fix

* added extra code to unique anonymous names

* added location data to type tests

* more fixes

* more fixes

* more fixes

* more fixes

* more fixes

* more fixes

* progress

* more fixes

* added warning

* update test

* added final bit to avoid casting in case of opt types in receiver

* added some warnings

* added more fixes
  • Loading branch information
ASDAlexander77 authored Oct 23, 2024
1 parent ed9dd70 commit d1e9cdf
Show file tree
Hide file tree
Showing 29 changed files with 1,322 additions and 570 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cmake-test-release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,6 @@ jobs:
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -j1 -C ${{ env.BUILD_TYPE }} -T test --output-on-failure -T test --output-on-failure
env:
LLVM_SYMBOLIZER_PATH: ${{github.workspace}}/3rdParty/llvm/release/bin

4 changes: 4 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ jobs:
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -j1 -C ${{ env.BUILD_TYPE }} -T test --output-on-failure -T test --output-on-failure
env:
LLVM_SYMBOLIZER_PATH: ${{github.workspace}}/3rdParty/llvm/release/bin

- name: Create Tar.GZ of Linux Asset
working-directory: ${{github.workspace}}/__build
Expand Down Expand Up @@ -446,6 +448,8 @@ jobs:
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -j1 -C ${{ env.BUILD_TYPE }} -T test --output-on-failure -T test --output-on-failure
env:
LLVM_SYMBOLIZER_PATH: ${{github.workspace}}/3rdParty/llvm/release/bin

- name: Create Tar.GZ of Linux Asset
working-directory: ${{github.workspace}}/__build
Expand Down
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-alpha55 -m "pre alpha v0.0-55"
git tag -a v0.0-pre-alpha56 -m "pre alpha v0.0-56"
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-alpha55
git tag -d v0.0-pre-alpha55
git push --delete origin v0.0-pre-alpha56
git tag -d v0.0-pre-alpha56
7 changes: 1 addition & 6 deletions tsc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,7 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_BINARY_DIR}/include)
link_directories(${LLVM_BUILD_LIBRARY_DIR})
add_definitions(${LLVM_DEFINITIONS})

if (WIN32)
else()
# linux
add_definitions(-D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING)
endif()
add_definitions(-D_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING)

# enabling testing
enable_testing()
Expand Down
3 changes: 2 additions & 1 deletion tsc/cmake/config_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ macro(set_Options)

if(MSVC)
# enable RTTI
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /GR")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /GR /we4715")
else()
#SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-unused-function -Wno-unused-result -Wno-unused-variable -Wno-unused-private-field -Wno-sign-compare -Wno-implicit-fallthrough -Wno-logical-op-parentheses -Wno-parentheses -Wno-unused-command-line-argument -frtti -lstdc++fs")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Expand All @@ -12,6 +12,7 @@ else()
endif()
# enable RTTI
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fexceptions")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
endif()

endmacro()
Expand Down
1 change: 1 addition & 0 deletions tsc/include/TypeScript/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@
#define FILE_DEBUG_SCOPE "file"
#define SUBPROGRAM_DEBUG_SCOPE "function"
#define BLOCK_DEBUG_SCOPE "block"
#define NAMESPACE_DEBUG_SCOPE "block"

#endif // DEFINES_H_
21 changes: 12 additions & 9 deletions tsc/include/TypeScript/LowerToLLVM/CastLogicHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class CastLogicHelper
{
MLIRTypeHelper mth(unionType.getContext());
mlir::Type baseType;
bool needTag = mth.isUnionTypeNeedsTag(unionType, baseType);
bool needTag = mth.isUnionTypeNeedsTag(loc, unionType, baseType);
if (!needTag)
{
auto llvmBoolType = tch.convertType(boolType);
Expand Down Expand Up @@ -512,7 +512,7 @@ class CastLogicHelper
{
MLIRTypeHelper mth(resUnionType.getContext());
mlir::Type baseType;
bool needTag = mth.isUnionTypeNeedsTag(resUnionType, baseType);
bool needTag = mth.isUnionTypeNeedsTag(loc, resUnionType, baseType);
if (needTag)
{
auto typeOfValue = rewriter.create<mlir_ts::TypeOfOp>(loc, mlir_ts::StringType::get(rewriter.getContext()), in);
Expand All @@ -530,7 +530,7 @@ class CastLogicHelper
{
MLIRTypeHelper mth(inUnionType.getContext());
mlir::Type baseType;
bool needTag = mth.isUnionTypeNeedsTag(inUnionType, baseType);
bool needTag = mth.isUnionTypeNeedsTag(loc, inUnionType, baseType);
if (!needTag)
{
return cast(in, baseType, tch.convertType(baseType), resType, resLLVMType);
Expand Down Expand Up @@ -696,9 +696,10 @@ class CastLogicHelper
<< inLLVMType << " size of #" << srcSize << ",\n " << resLLVMType << " size of #" << dstSize;
}

auto srcAddr = rewriter.create<mlir_ts::VariableOp>(loc, mlir_ts::RefType::get(inType), in, rewriter.getBoolAttr(false));
auto dstAddr =
rewriter.create<mlir_ts::VariableOp>(loc, mlir_ts::RefType::get(resType), mlir::Value(), rewriter.getBoolAttr(false));
auto srcAddr = rewriter.create<mlir_ts::VariableOp>(
loc, mlir_ts::RefType::get(inType), in, rewriter.getBoolAttr(false), rewriter.getIndexAttr(0));
auto dstAddr = rewriter.create<mlir_ts::VariableOp>(loc, mlir_ts::RefType::get(resType),
mlir::Value(), rewriter.getBoolAttr(false), rewriter.getIndexAttr(0));
if (srcSize <= 8 && dstSize <= 8)
{
rewriter.create<mlir_ts::LoadSaveOp>(loc, dstAddr, srcAddr);
Expand All @@ -718,7 +719,8 @@ class CastLogicHelper
if (destPtr.getElementType() == inLLVMType)
{
// alloc and return address
auto valueAddr = rewriter.create<mlir_ts::VariableOp>(loc, mlir_ts::RefType::get(inType), in, rewriter.getBoolAttr(false));
auto valueAddr = rewriter.create<mlir_ts::VariableOp>(
loc, mlir_ts::RefType::get(inType), in, rewriter.getBoolAttr(false), rewriter.getIndexAttr(0));
return valueAddr;
}
}
Expand Down Expand Up @@ -981,7 +983,7 @@ class CastLogicHelper
{
MLIRTypeHelper mth(unionType.getContext());
mlir::Type baseType;
bool needTag = mth.isUnionTypeNeedsTag(unionType, baseType);
bool needTag = mth.isUnionTypeNeedsTag(loc, unionType, baseType);
if (needTag)
{
typeOfValue = toh.typeOfLogic(loc, valueForBoxing, unionType);
Expand Down Expand Up @@ -1024,7 +1026,8 @@ class CastLogicHelper
return clh.castToI8Ptr(variableOp);
}

auto valueAddr = rewriter.create<mlir_ts::VariableOp>(loc, mlir_ts::RefType::get(in.getType()), in, rewriter.getBoolAttr(false));
auto valueAddr = rewriter.create<mlir_ts::VariableOp>(
loc, mlir_ts::RefType::get(in.getType()), in, rewriter.getBoolAttr(false), rewriter.getIndexAttr(0));

mlir::Value valueAddrAsLLVMType = rewriter.create<mlir_ts::DialectCastOp>(loc, tch.convertType(valueAddr.getType()), valueAddr);

Expand Down
Loading

0 comments on commit d1e9cdf

Please sign in to comment.