Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 47 additions & 0 deletions include/InstModel/LFCPAInstModel/LFCPAInstModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef LFCPAINSTMODEL_LFCPAINSTMODEL_H
#define LFCPAINSTMODEL_LFCPAINSTMODEL_H

#include "spatial/InstInfo/InstInfo.h"
#include "spatial/InstModel/InstModel.h"
#include "spatial/Token/Token.h"
#include "vector"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Operator.h"

namespace spatial {

class LFCPAInstModel : public InstModel {
std::map<llvm::Instruction*, spatial::InstInfo*> InstInfoMap;
public:
using InstModel::InstModel;

~LFCPAInstModel();
std::vector<int> extractRedirections(llvm::Instruction *);
InstInfo extractInstInfo(llvm::Instruction *);

std::vector<Token *> extractToken(llvm::Instruction *);
std::vector<Token *> extractToken(llvm::StoreInst *);
std::vector<Token *> extractToken(llvm::LoadInst *);
std::vector<Token *> extractToken(llvm::AllocaInst *);
std::vector<Token *> extractToken(llvm::BitCastInst *);
std::vector<Token *> extractToken(llvm::ReturnInst *);
std::vector<Token *> extractToken(llvm::GetElementPtrInst *);
std::vector<Token *> extractToken(llvm::GlobalVariable *);
std::vector<Token *> extractToken(llvm::CallInst *);
std::vector<Token *> extractToken(llvm::CmpInst *);
std::vector<Token *> extractToken(llvm::Argument *, llvm::Function *);

std::vector<int> extractRedirections(llvm::GlobalVariable *);
template <typename GEP> Token *handleGEPUtil(GEP *, Token *);
Token * handleGEPUtil_1(llvm::GEPOperator *, Token *);
bool isInstSkip (llvm::Instruction *);
template <typename GOP> bool isStructFieldPointerTy(GOP *);
Token* extractDummy(std::string);
};
} // namespace spatial

#endif
6 changes: 6 additions & 0 deletions include/Token/Token.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Token {
public:
void setIndex(llvm::GetElementPtrInst *GEPInst);
void setIndex(llvm::GEPOperator *GEPOp);
void setIndex(std::string); //Added on 31.5.21
void resetIndex();
std::string getIndex(llvm::GEPOperator *GEPOp);

Expand All @@ -54,6 +55,7 @@ class Token {
std::string getMemTypeName() const;
std::string getFunctionName() const;
std::string getFieldIndex() const;

friend std::ostream &operator<<(std::ostream &OS, const Token &A);

bool isMem() const;
Expand All @@ -63,11 +65,15 @@ class Token {
bool isAllocaOrArgOrGlobal() const;
bool sameFunc(llvm::Function *Func) const;
bool isBasePointerType() const;
bool isValPointerType() const;
std::string getHash() const;
bool isPointerType() const;

bool operator<(const Token &TheToken) const;
bool operator==(const Token &TheToken) const;
void operator=(const Token &TheToken);


};
} // namespace spatial

Expand Down
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ add_subdirectory(InstInfo)
add_subdirectory(InstModel)

# TODO: Write this in multiple lines
add_library (Spatial SHARED $<TARGET_OBJECTS:Token> $<TARGET_OBJECTS:Benchmark> $<TARGET_OBJECTS:Worklist> $<TARGET_OBJECTS:Utils> $<TARGET_OBJECTS:InstInfo> $<TARGET_OBJECTS:InstModel> $<TARGET_OBJECTS:GenericInstModel>)
add_library (Spatial SHARED $<TARGET_OBJECTS:Token> $<TARGET_OBJECTS:Benchmark> $<TARGET_OBJECTS:Worklist> $<TARGET_OBJECTS:Utils> $<TARGET_OBJECTS:InstInfo> $<TARGET_OBJECTS:InstModel> $<TARGET_OBJECTS:GenericInstModel> $<TARGET_OBJECTS:LFCPAInstModel>)

set_target_properties(Spatial PROPERTIES
SOVERSION 0
Expand Down
1 change: 1 addition & 0 deletions lib/InstModel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ set_target_properties(InstModel PROPERTIES
)

add_subdirectory(GenericInstModel)
add_subdirectory(LFCPAInstModel)
7 changes: 7 additions & 0 deletions lib/InstModel/LFCPAInstModel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
add_library (LFCPAInstModel OBJECT
LFCPAInstModel.cpp
)

set_target_properties(LFCPAInstModel PROPERTIES
COMPILE_FLAGS "-g -std=c++14 -fno-rtti -fPIC"
)
Loading