Skip to content

Commit

Permalink
Weak linker pass (#127)
Browse files Browse the repository at this point in the history
* WiP

* Analysis pass working

* Removing incorrectly checked in toolchain

* Finalising v. 1 of function replacer

* Formatting

* Removing orig files

* Adding string map to CLI

* Replacement interface

* Fixing CI

* Forcing restart of CI

* Finish tests

* Formatting

* Fixing CI issues

* Removing .orig

* Updating
  • Loading branch information
troelsfr authored Sep 5, 2022
1 parent b2e967a commit 7ee3d2a
Show file tree
Hide file tree
Showing 60 changed files with 1,795 additions and 289 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,4 @@ bazel-*/
/.cache/

.bazelrc.user
.bazelrc.configure
.bazelrc.configure.orig
143 changes: 0 additions & 143 deletions WORKSPACE.orig

This file was deleted.

3 changes: 2 additions & 1 deletion qir/qat/Apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ target_link_libraries(qat
PostTransformValidation
PreTransformTrimming
ZExtTransformPass
DeferMeasurementPass
DeferMeasurementPass
FunctionReplacementPass
Version
yaml-cpp)

Expand Down
33 changes: 0 additions & 33 deletions qir/qat/Apps/CMakeLists.txt.orig

This file was deleted.

6 changes: 4 additions & 2 deletions qir/qat/Apps/Qat/Qat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ int main(int argc, char const** argv)
auto location_table = loader.locationTable();
logger->setLocationResolver([location_table](llvm::Value const* val)
{ return location_table->getPosition(val); });
logger->setLocationFromNameResolver([location_table](String const& name)
{ return location_table->getPositionFromFunctionName(name); });

// Getting the optimization level
//
Expand Down Expand Up @@ -329,7 +331,7 @@ int main(int argc, char const** argv)
profile->apply(*module);

// Preventing subsequent routines to run if errors occurred.
if (logger && (logger->hadErrors() || logger->hadWarnings()))
if (logger && logger->hadErrors())
{
ret = -1;
}
Expand Down Expand Up @@ -391,7 +393,7 @@ int main(int argc, char const** argv)

// Safety pre-caution to ensure that all errors and warnings reported
// results in failure.
if (logger && (logger->hadErrors() || logger->hadWarnings()))
if (logger && logger->hadErrors())
{
ret = -1;
}
Expand Down
16 changes: 16 additions & 0 deletions qir/qat/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,19 @@ ms_cc_library(
],
)

ms_cc_library(
name = "FunctionReplacementPass",
srcs = glob(["FunctionReplacementPass/*.cpp"]),
hdrs = glob(["FunctionReplacementPass/*.hpp"]),
visibility = ["//visibility:public"],
deps = [
"//qir/qat:Commandline",
"//qir/qat:Llvm",
"//qir/qat:Logging",
"//qir/qat:QatTypes",
],
)

ms_cc_library(
name = "RemoveDisallowedAttributesPass",
srcs = glob(["RemoveDisallowedAttributesPass/*.cpp"]),
Expand Down Expand Up @@ -348,6 +361,7 @@ ms_cc_library(
"//qir/qat:AllocationManager",
"//qir/qat:Commandline",
"//qir/qat:DeferMeasurementPass",
"//qir/qat:FunctionReplacementPass",
"//qir/qat:GroupingPass",
"//qir/qat:Llvm",
"//qir/qat:Logging",
Expand Down Expand Up @@ -391,6 +405,7 @@ ms_cc_library(
deps = [
"//qir/qat:AllocationManager",
"//qir/qat:Commandline",
"//qir/qat:FunctionReplacementPass",
"//qir/qat:Generators",
"//qir/qat:GroupingPass",
"//qir/qat:Llvm",
Expand Down Expand Up @@ -422,6 +437,7 @@ ms_cc_binary(
"//qir/qat:AllocationManager",
"//qir/qat:Commandline",
"//qir/qat:DeferMeasurementPass",
"//qir/qat:FunctionReplacementPass",
"//qir/qat:Generators",
"//qir/qat:GroupingPass",
"//qir/qat:Llvm",
Expand Down
5 changes: 3 additions & 2 deletions qir/qat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ microsoft_add_library(StaticResourceComponent Logging)
microsoft_add_library_tests(StaticResourceComponent Rules TransformationRulesPass AllocationManager Commandline Generators Validator ValidationPass Logging GroupingPass)


microsoft_add_library(FunctionReplacementPass Logging)
microsoft_add_library(GroupingPass Logging)
microsoft_add_library(ZExtTransformPass Logging)
microsoft_add_library_tests(ZExtTransformPass Rules TransformationRulesPass AllocationManager Commandline Generators Validator ValidationPass StaticResourceComponent Logging GroupingPass)
Expand All @@ -57,7 +58,7 @@ microsoft_add_library_tests(Rules Rules TransformationRulesPass AllocationManage
target_link_libraries(Rules PRIVATE AllocationManager)

microsoft_add_library(Generators)
target_link_libraries(Generators PRIVATE Rules Commandline AllocationManager TransformationRulesPass Profile Validator StaticResourceComponent ValidationPass PostTransformValidation PreTransformTrimming ZExtTransformPass DeferMeasurementPass)
microsoft_add_library_tests(Generators Rules TransformationRulesPass AllocationManager Commandline Generators Logging GroupingPass ZExtTransformPass)
target_link_libraries(Generators PRIVATE Rules Commandline AllocationManager TransformationRulesPass Profile Validator StaticResourceComponent ValidationPass PostTransformValidation PreTransformTrimming ZExtTransformPass FunctionReplacementPass DeferMeasurementPass)
microsoft_add_library_tests(Generators Rules TransformationRulesPass AllocationManager Commandline Generators Logging GroupingPass ZExtTransformPass FunctionReplacementPass)

add_subdirectory(Apps)
Loading

0 comments on commit 7ee3d2a

Please sign in to comment.