LLVM: lib/ExecutionEngine/Interpreter/Interpreter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

19#include

20using namespace llvm;

21

22namespace {

23

24static struct RegisterInterp {

26} InterpRegistrator;

27

28}

29

31

32

33

35 std::string *ErrStr) {

36

37 if (Error Err = M->materializeAll()) {

38 std::string Msg;

41 });

42 if (ErrStr)

43 *ErrStr = Msg;

44

45 return nullptr;

46 }

47

49}

50

51

52

53

56

57 memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped));

58

59 initializeExecutionEngine();

60 initializeExternalFunctions();

62

64}

65

69

71 while (!AtExitHandlers.empty()) {

73 AtExitHandlers.pop_back();

75 }

76}

77

78

79

82 assert (F && "Function *F was null at entry to run()");

83

84

85

86

87

88

89

90

91 const size_t ArgCount = F->getFunctionType()->getNumParams();

93 ArgValues.slice(0, std::min(ArgValues.size(), ArgCount));

94

95

97

98

100

101 return ExitValue;

102}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Module.h This file contains the declarations for the Module class.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t size() const

size - Get the array size.

ArrayRef< T > slice(size_t N, size_t M) const

slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.

Base class for error info classes.

virtual std::string message() const

Return the error message as a string.

Lightweight error class with error context and mandatory checking.

const DataLayout & getDataLayout() const

ExecutionEngine(DataLayout DL)

void emitGlobals()

EmitGlobals - Emit all of the global variables to memory, storing their addresses into GlobalAddress.

~Interpreter() override

Definition Interpreter.cpp:66

void runAtExitHandlers()

runAtExitHandlers - Run any functions registered by the program's calls to atexit(3),...

Definition Interpreter.cpp:70

Interpreter(std::unique_ptr< Module > M)

Definition Interpreter.cpp:54

void callFunction(Function *F, ArrayRef< GenericValue > ArgVals)

GenericValue runFunction(Function *F, ArrayRef< GenericValue > ArgValues) override

run - Start execution with the specified function and arguments.

Definition Interpreter.cpp:80

static ExecutionEngine * create(std::unique_ptr< Module > M, std::string *ErrorStr=nullptr)

Create an interpreter ExecutionEngine.

Definition Interpreter.cpp:34

void LLVMLinkInInterpreter()

Empty function used to force the linker to link the LLVM interpreter.

Definition Interpreter.cpp:30

This is an optimization pass for GlobalISel generic memory operations.

void handleAllErrors(Error E, HandlerTs &&... Handlers)

Behaves the same as handleErrors, except that by contract all errors must be handled by the given han...

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Implement std::hash so that hash_code can be used in STL containers.