Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Dec 14, 2023
1 parent 6889ead commit 0203fec
Showing 1 changed file with 2 additions and 45 deletions.
47 changes: 2 additions & 45 deletions libclambcc/ClamBCConvertIntrinsics/ClamBCConvertIntrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

#include <llvm/IR/Dominators.h>
#include <llvm/IR/Constants.h>

//#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include <llvm/Transforms/IPO/PassManagerBuilder.h>

#include "Common/clambc.h"

Expand All @@ -24,26 +22,17 @@ using namespace llvm;

namespace ClamBCConvertIntrinsics {

#if 0
class ClamBCConvertIntrinsics : public ModulePass
#else
class ClamBCConvertIntrinsics : public PassInfoMixin<ClamBCConvertIntrinsics >
#endif
{

public:
static char ID;

ClamBCConvertIntrinsics()
/* : ModulePass(ID) */ {}
ClamBCConvertIntrinsics() {}

virtual ~ClamBCConvertIntrinsics() {}

#if 0
virtual bool runOnModule(Module& mod)
#else
PreservedAnalyses run(Module & mod, ModuleAnalysisManager & MAM)
#endif
{
bChanged = false;
pMod = &mod;
Expand All @@ -59,15 +48,11 @@ class ClamBCConvertIntrinsics : public PassInfoMixin<ClamBCConvertIntrinsics >
delLst[i]->eraseFromParent();
}

#if 0
return bChanged;
#else
if (bChanged){
return PreservedAnalyses::none();
}

return PreservedAnalyses::all();
#endif
}

protected:
Expand Down Expand Up @@ -103,11 +88,7 @@ class ClamBCConvertIntrinsics : public PassInfoMixin<ClamBCConvertIntrinsics >
std::vector<Value*> args;
Type* i32Ty = Type::getInt32Ty(pMod->getContext());

#if 0
for (size_t i = 0; i < pci->getNumArgOperands(); i++)
#else
for (size_t i = 0; i < pci->arg_size(); i++)
#endif
{
Value* pv = pci->getArgOperand(i);
if (2 == i) {
Expand All @@ -126,22 +107,6 @@ class ClamBCConvertIntrinsics : public PassInfoMixin<ClamBCConvertIntrinsics >
delLst.push_back(pci);
}

// llvm::FunctionCallee* getNewMemset()
// {
// static llvm::FunctionCallee* ret = nullptr;
//
// if (nullptr == ret) {
//
// FunctionType* retType = getMemsetType();
// static llvm::FunctionCallee fc = pMod->getOrInsertFunction("llvm.memset.p0i8.i32", retType);
// ret = &fc;
//
// assert(ret && "Could not get memset");
// }

// return ret;
// }

llvm::FunctionType* getMemsetType()
{
static FunctionType* retType = nullptr;
Expand All @@ -157,13 +122,6 @@ class ClamBCConvertIntrinsics : public PassInfoMixin<ClamBCConvertIntrinsics >

} // end of anonymous namespace

#if 0
char ClamBCConvertIntrinsics::ID = 0;
static RegisterPass<ClamBCConvertIntrinsics> XX("clambc-convert-intrinsics", "Convert Intrinsics to 32-bit",
false /* Only looks at CFG */,
false /* Analysis Pass */);
#else

// This part is the new way of registering your pass
extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
llvmGetPassPluginInfo() {
Expand All @@ -185,4 +143,3 @@ llvmGetPassPluginInfo() {
}


#endif

0 comments on commit 0203fec

Please sign in to comment.