Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi committed Jul 24, 2023
1 parent 9720b00 commit ed15da5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
Binary file modified lib/libtheta-llvm.so
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "hu_bme_mit_theta_llvm2xcfa_LlvmIrProvider.h"
#include "types/Module.h"
#include "utilities/CPipeline.h"
#include "utilities/Analysis.h"
#include "types/BasicBlock.h"
#include "types/operands/Register.h"

// NOTE: don't use CLions automatic code formatting, it handles this part pretty badly

Expand All @@ -11,13 +14,18 @@
*/
JNIEXPORT void JNICALL
Java_hu_bme_mit_theta_llvm2xcfa_LlvmIrProvider_JniParseIr(JNIEnv* env, jobject, jstring filename) {
Analysis::reset();
BasicBlock::reset();
Register::reset();

// Convert the JNI String (jstring) into C-String (char*)
const char *cFilename = env->GetStringUTFChars(filename, NULL);
if (NULL == cFilename) {
std::cout << "Could not get filename from jenv!" << std::endl;
return;
}


// (compile and) parse into llvm Module
std::unique_ptr <llvm::Module> llvmModule;
llvm::SMDiagnostic error;
Expand Down
3 changes: 0 additions & 3 deletions subprojects/frontends/llvm/src/main/cpp/types/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ Module::Module() {

void Module::parseLLVMModule(std::shared_ptr <llvm::Module> llvmModule) {
instance = Module();
Analysis::reset();
BasicBlock::reset();
Register::reset();

// Analyze module first
Analysis::checkModule(llvmModule.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ bool Analysis::checkIfAndOrXor(const llvm::BinaryOperator *binOp) {
}

void Analysis::reset() {
// hasIntInBitwiseBinaryOp = false;
// hasStructs = false;
hasIntInBitwiseBinaryOp = false;
hasStructs = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ public void handleInstruction(Instruction instruction, GlobalState globalState,
break;
case "udiv":
udiv(instruction, globalState, functionState, blockState);
break;
case "sdiv":
sdiv(instruction, globalState, functionState, blockState);
break;
case "urem":
urem(instruction, globalState, functionState, blockState);
break;
case "srem":
srem(instruction, globalState, functionState, blockState);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ int main() {
int a, b;
scanf("%d", &a);
scanf("%d", &b);
//
// int c = a << 2;
// int d = b >> 2;
// int e = c | d & 11;
return a&&b;

int c = a << 2;
int d = b >> 2;
int e = c | d & 11;
return (unsigned long long)(char)(e + a - b * c / d);
}

0 comments on commit ed15da5

Please sign in to comment.