From beb541cd1593684e2f8b212366ffaba134274e4b Mon Sep 17 00:00:00 2001 From: Andy Ragusa Date: Fri, 15 Dec 2023 11:20:35 -0800 Subject: [PATCH] blah --- clambcc/clambc-compiler.py | 6 ++-- libclambcc/CMakeLists.txt | 2 +- .../CMakeLists.txt | 34 +++++++++---------- .../ClamBCConvertMemsetsTo32Bit.cpp} | 16 ++++----- 4 files changed, 29 insertions(+), 29 deletions(-) rename libclambcc/{ClamBCConvertIntrinsics => ClamBCConvertMemsetsTo32Bit}/CMakeLists.txt (55%) rename libclambcc/{ClamBCConvertIntrinsics/ClamBCConvertIntrinsics.cpp => ClamBCConvertMemsetsTo32Bit/ClamBCConvertMemsetsTo32Bit.cpp} (88%) diff --git a/clambcc/clambc-compiler.py b/clambcc/clambc-compiler.py index 0dd31bb321..23e3240a6d 100755 --- a/clambcc/clambc-compiler.py +++ b/clambcc/clambc-compiler.py @@ -583,7 +583,7 @@ def createInputSourceFile(clangLLVM: ClangLLVM, name: str, args: list, options: , 'verify' , 'clambc-extend-phis-to-64-bit' , 'verify' - , 'clambc-convert-intrinsics' + , 'clambc-convert-memsets-to-32Bit' , 'verify' , 'globalopt' , 'clambc-prepare-geps-for-writer' @@ -611,7 +611,7 @@ def createInputSourceFile(clangLLVM: ClangLLVM, name: str, args: list, options: , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcoutlineendiannesscalls.so" , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcchangemallocargsize.so" , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcextendphisto64bit.so" - , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcconvertintrinsics.so" + , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcconvertmemsetsto32bit.so" , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcpreparegepsforwriter.so" , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcanalyzer.so" , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcregalloc.so" @@ -707,7 +707,7 @@ def optimize(clangLLVM: ClangLLVM, inFile: str, outFile: str, sigFile: str, inpu #otherwise the writer gets #unhappy. f' -globalopt' - f' -clambc-convert-intrinsics' #convert all memset intrinsics to + f' -clambc-convert-memsets-to-32Bit' #convert all memset intrinsics to #the 32-bit instead of the 64-bit #intrinsic f' -clambc-writer' #write the bytecode diff --git a/libclambcc/CMakeLists.txt b/libclambcc/CMakeLists.txt index d0ba6f788a..00f9fc9968 100644 --- a/libclambcc/CMakeLists.txt +++ b/libclambcc/CMakeLists.txt @@ -19,7 +19,7 @@ add_subdirectory(ClamBCExtendPHIsTo64Bit) add_subdirectory(ClamBCRebuild) add_subdirectory(ClamBCRegAlloc) #add_subdirectory(ClamBCTypeAnalyzer) -add_subdirectory(ClamBCConvertIntrinsics) +add_subdirectory(ClamBCConvertMemsetsTo32Bit) add_subdirectory(ClamBCPrepareGEPsForWriter) add_subdirectory(ClamBCRemoveICMPSLE) #add_subdirectory(ClamBCRemoveUMIN) diff --git a/libclambcc/ClamBCConvertIntrinsics/CMakeLists.txt b/libclambcc/ClamBCConvertMemsetsTo32Bit/CMakeLists.txt similarity index 55% rename from libclambcc/ClamBCConvertIntrinsics/CMakeLists.txt rename to libclambcc/ClamBCConvertMemsetsTo32Bit/CMakeLists.txt index 4fbe4dcc87..49847ee586 100644 --- a/libclambcc/ClamBCConvertIntrinsics/CMakeLists.txt +++ b/libclambcc/ClamBCConvertMemsetsTo32Bit/CMakeLists.txt @@ -1,15 +1,15 @@ # Copyright (C) 2021 Cisco Systems, Inc. and/or its affiliates. All rights reserved. # -# The clambcconvertintrinsics object library +# The clambcconvertmemsetsto32bit object library # -add_library(clambcconvertintrinsics_obj OBJECT) -target_sources(clambcconvertintrinsics_obj +add_library(clambcconvertmemsetsto32bit_obj OBJECT) +target_sources(clambcconvertmemsetsto32bit_obj PRIVATE - ClamBCConvertIntrinsics.cpp + ClamBCConvertMemsetsTo32Bit.cpp ) -target_include_directories(clambcconvertintrinsics_obj +target_include_directories(clambcconvertmemsetsto32bit_obj PRIVATE ${CMAKE_BINARY_DIR} # For clambc-version.h (generated file) . # For Common/clambc.h @@ -17,35 +17,35 @@ target_include_directories(clambcconvertintrinsics_obj ${LLVM_INCLUDE_DIRS} ) -set_target_properties(clambcconvertintrinsics_obj PROPERTIES COMPILE_FLAGS "${WARNCXXFLAGS}") +set_target_properties(clambcconvertmemsetsto32bit_obj PROPERTIES COMPILE_FLAGS "${WARNCXXFLAGS}") # # For testing # -#target_compile_definitions(clambcconvertintrinsics_obj -DLOG_BEFORE_AFTER=1) +#target_compile_definitions(clambcconvertmemsetsto32bit_obj -DLOG_BEFORE_AFTER=1) # -# The clambcconvertintrinsics shared library. +# The clambcconvertmemsetsto32bit shared library. # -add_library( clambcconvertintrinsics SHARED ) -target_link_libraries( clambcconvertintrinsics +add_library( clambcconvertmemsetsto32bit SHARED ) +target_link_libraries( clambcconvertmemsetsto32bit PUBLIC - clambcconvertintrinsics_obj ) -set_target_properties( clambcconvertintrinsics PROPERTIES + clambcconvertmemsetsto32bit_obj ) +set_target_properties( clambcconvertmemsetsto32bit PROPERTIES VERSION ${LIBCLAMBC_VERSION} SOVERSION ${LIBCLAMBC_SOVERSION} ) -target_link_directories(clambcconvertintrinsics PRIVATE ${LLVM_LIBRARY_DIRS}) -target_link_libraries(clambcconvertintrinsics PUBLIC ${LLVM_LIBS}) +target_link_directories(clambcconvertmemsetsto32bit PRIVATE ${LLVM_LIBRARY_DIRS}) +target_link_libraries(clambcconvertmemsetsto32bit PUBLIC ${LLVM_LIBS}) if(WIN32) - install(TARGETS clambcconvertintrinsics DESTINATION .) + install(TARGETS clambcconvertmemsetsto32bit DESTINATION .) # Also install shared library (DLL) dependencies install(CODE [[ file(GET_RUNTIME_DEPENDENCIES LIBRARIES - $ + $ RESOLVED_DEPENDENCIES_VAR _r_deps UNRESOLVED_DEPENDENCIES_VAR _u_deps DIRECTORIES @@ -65,7 +65,7 @@ if(WIN32) #message("UNRESOLVED_DEPENDENCIES_VAR: ${_u_deps}") ]]) else() - install(TARGETS clambcconvertintrinsics DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(TARGETS clambcconvertmemsetsto32bit DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/libclambcc/ClamBCConvertIntrinsics/ClamBCConvertIntrinsics.cpp b/libclambcc/ClamBCConvertMemsetsTo32Bit/ClamBCConvertMemsetsTo32Bit.cpp similarity index 88% rename from libclambcc/ClamBCConvertIntrinsics/ClamBCConvertIntrinsics.cpp rename to libclambcc/ClamBCConvertMemsetsTo32Bit/ClamBCConvertMemsetsTo32Bit.cpp index e59edd4731..db925bd797 100644 --- a/libclambcc/ClamBCConvertIntrinsics/ClamBCConvertIntrinsics.cpp +++ b/libclambcc/ClamBCConvertMemsetsTo32Bit/ClamBCConvertMemsetsTo32Bit.cpp @@ -20,17 +20,17 @@ using namespace llvm; -namespace ClamBCConvertIntrinsics { +namespace ClamBCConvertMemsetsTo32Bit { -class ClamBCConvertIntrinsics : public PassInfoMixin +class ClamBCConvertMemsetsTo32Bit : public PassInfoMixin { public: static char ID; - ClamBCConvertIntrinsics() {} + ClamBCConvertMemsetsTo32Bit() {} - virtual ~ClamBCConvertIntrinsics() {} + virtual ~ClamBCConvertMemsetsTo32Bit() {} PreservedAnalyses run(Module & mod, ModuleAnalysisManager & MAM) { @@ -95,7 +95,7 @@ class ClamBCConvertIntrinsics : public PassInfoMixin if (ConstantInt* ci = llvm::dyn_cast(pv)) { pv = ConstantInt::get(i32Ty, ci->getValue().getLimitedValue()); } else { - pv = CastInst::CreateTruncOrBitCast(pv, i32Ty, "ClamBCConvertIntrinsics_trunc_", pci); + pv = CastInst::CreateTruncOrBitCast(pv, i32Ty, "ClamBCConvertMemsetsTo32Bit_trunc_", pci); } } @@ -126,13 +126,13 @@ class ClamBCConvertIntrinsics : public PassInfoMixin extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK llvmGetPassPluginInfo() { return { - LLVM_PLUGIN_API_VERSION, "ClamBCConvertIntrinsics", "v0.1", + LLVM_PLUGIN_API_VERSION, "ClamBCConvertMemsetsTo32Bit", "v0.1", [](PassBuilder &PB) { PB.registerPipelineParsingCallback( [](StringRef Name, ModulePassManager &FPM, ArrayRef) { - if(Name == "clambc-convert-intrinsics"){ - FPM.addPass(ClamBCConvertIntrinsics::ClamBCConvertIntrinsics()); + if(Name == "clambc-convert-memsets-to-32Bit"){ + FPM.addPass(ClamBCConvertMemsetsTo32Bit::ClamBCConvertMemsetsTo32Bit()); return true; } return false;