Jlm
Loading...
Searching...
No Matches
Functions
TraceTests.cpp File Reference
#include <gtest/gtest.h>
#include <jlm/llvm/ir/operators/alloca.hpp>
#include <jlm/llvm/ir/operators/ConversionOperations.hpp>
#include <jlm/llvm/ir/operators/IntegerOperations.hpp>
#include <jlm/llvm/ir/operators/IOBarrier.hpp>
#include <jlm/llvm/ir/operators/lambda.hpp>
#include <jlm/llvm/ir/operators/operators.hpp>
#include <jlm/llvm/ir/Trace.hpp>
#include <jlm/llvm/ir/types.hpp>
#include <jlm/rvsdg/bitstring/comparison.hpp>
#include <jlm/rvsdg/bitstring/constant.hpp>
#include <jlm/rvsdg/control.hpp>
#include <jlm/rvsdg/gamma.hpp>
#include <jlm/rvsdg/lambda.hpp>
#include <jlm/rvsdg/theta.hpp>
#include <cassert>
Include dependency graph for TraceTests.cpp:

Go to the source code of this file.

Functions

 TEST (TraceTests, testTracingIOBarrier)
 
 TEST (TraceTests, testGetConstantSignedInteger)
 
 TEST (TraceTests, testGetConstantSignedIntegerExtAndTrunc)
 
 TEST (TraceTests, testGetConstantSignedIntegerExtThroughGamma)
 
 TEST (TraceTests, testTraceAllPointerOriginsTheta)
 

Function Documentation

◆ TEST() [1/5]

TEST ( TraceTests  ,
testGetConstantSignedInteger   
)

Definition at line 62 of file TraceTests.cpp.

◆ TEST() [2/5]

TEST ( TraceTests  ,
testGetConstantSignedIntegerExtAndTrunc   
)

Creates an RVSDG graph that look like:

c = BITS32(5) sext = SExt(32 -> 64) c // Should be 5 zext = ZExt(32 -> 64) c // Should be 5

c2 = BITS8(-20) // Should be -20 (0b1110 1100) sext2 = SExt(8 -> 32) c2 // Should be -20 (0b1111 .... 1110 1100) zext2 = ZExt(8 -> 32) c2 // Should be 236 (0b0000 .... 1110 1100)

c3 = BITS32(1023) trunc3 = Trunc(32 -> 8) // Should be -1 (0b1111 1111) sext3 = SExt(8 -> 32) trunc3 // Should be -1 (0b1111 .... 1111 1111) zext3 = ZExt(8 -> 32) trunc3 // Should be 255 (0b0000 .... 1111 1111)

and uses tryGetConstantSignedInteger to get the integer values of the different constants.

Definition at line 142 of file TraceTests.cpp.

◆ TEST() [3/5]

TEST ( TraceTests  ,
testGetConstantSignedIntegerExtThroughGamma   
)

Creates an RVSDG graph that look like:

x = BITS8(-20) c = CTRL(1)

exitVar = gamma c x [_, x1] { } [x1] [_, x2] { } [x2]

sext = SExt[8->32] exitVar // should be -20 (0xFFFFFFEC) trunc = Trunc[32->16] sext // should be -20 (0xFFEC) zext = ZExt[16->32] trunc // should be 65516 (0x0000FFEC)

GraphExport(zext)

and uses tryGetConstantSignedInteger to get the integer values conversion outputs

Definition at line 210 of file TraceTests.cpp.

◆ TEST() [4/5]

TEST ( TraceTests  ,
testTraceAllPointerOriginsTheta   
)

Creates an RVSDG corresponding to the C code:

int func() {
int array[101];
int i = 0;
int* p = &array;
do {
*p = i;
p++;
i++;
} while(i < 100);
return *p;
}

The test checks that jlm::llvm::TraceAllPointerOrigins is able to trace the origin of p, both from within the loop, and after the loop. The resulting jlm::llvm::TraceCollection should have exactly one top origin: array, and the offset should be unknown.

Definition at line 263 of file TraceTests.cpp.

◆ TEST() [5/5]

TEST ( TraceTests  ,
testTracingIOBarrier   
)

Definition at line 25 of file TraceTests.cpp.