2001-08-23 17:05:04 +00:00
|
|
|
//===-- ExecutionAnnotations.h ---------------------------------*- C++ -*--===//
|
|
|
|
//
|
|
|
|
// This header file defines annotations used by the execution engine.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLI_EXECUTION_ANNOTATIONS_H
|
|
|
|
#define LLI_EXECUTION_ANNOTATIONS_H
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2003-05-08 16:18:31 +00:00
|
|
|
// Support for FunctionInfo annotations
|
2001-08-23 17:05:04 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2002-04-07 20:49:59 +00:00
|
|
|
// This annotation (attached only to Function objects) is used to cache useful
|
|
|
|
// information about the function, including the number of types present in the
|
|
|
|
// function, and the number of values for each type.
|
2001-08-23 17:05:04 +00:00
|
|
|
//
|
|
|
|
// This annotation object is created on demand, and attaches other annotation
|
2002-04-07 20:49:59 +00:00
|
|
|
// objects to the instructions in the function when it's created.
|
2001-08-23 17:05:04 +00:00
|
|
|
//
|
2003-05-08 16:18:31 +00:00
|
|
|
static AnnotationID FunctionInfoAID(
|
2002-04-07 20:49:59 +00:00
|
|
|
AnnotationManager::getID("Interpreter::FunctionInfo"));
|
2001-08-23 17:05:04 +00:00
|
|
|
|
2003-05-08 16:18:31 +00:00
|
|
|
struct FunctionInfo : public Annotation {
|
|
|
|
FunctionInfo(Function *F);
|
2002-01-20 22:54:45 +00:00
|
|
|
std::vector<unsigned> NumPlaneElements;
|
2001-08-23 17:05:04 +00:00
|
|
|
|
2003-05-08 16:18:31 +00:00
|
|
|
// Create - Factory function to allow FunctionInfo annotations to be
|
2001-10-15 05:51:48 +00:00
|
|
|
// created on demand.
|
|
|
|
//
|
|
|
|
static Annotation *Create(AnnotationID AID, const Annotable *O, void *) {
|
2003-05-08 16:18:31 +00:00
|
|
|
assert(AID == FunctionInfoAID);
|
|
|
|
return new FunctionInfo(cast<Function>((Value*)O));
|
2001-10-15 05:51:48 +00:00
|
|
|
}
|
|
|
|
|
2001-08-23 17:05:04 +00:00
|
|
|
private:
|
|
|
|
unsigned getValueSlot(const Value *V);
|
|
|
|
};
|
|
|
|
|
2002-03-26 18:02:30 +00:00
|
|
|
|
2001-08-23 17:05:04 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Support for the SlotNumber annotation
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2002-04-09 19:40:40 +00:00
|
|
|
// This annotation (attached only to Argument & Instruction objects) is used to
|
|
|
|
// hold the the slot number for the value in its type plane.
|
2001-08-23 17:05:04 +00:00
|
|
|
//
|
|
|
|
// Entities have this annotation attached to them when the containing
|
2003-05-08 16:18:31 +00:00
|
|
|
// function has it's FunctionInfo created (by the FunctionInfo ctor).
|
2001-08-23 17:05:04 +00:00
|
|
|
//
|
|
|
|
static AnnotationID SlotNumberAID(
|
|
|
|
AnnotationManager::getID("Interpreter::SlotNumber"));
|
|
|
|
|
|
|
|
struct SlotNumber : public Annotation {
|
|
|
|
unsigned SlotNum; // Ranges from 0->
|
|
|
|
|
|
|
|
SlotNumber(unsigned sn) : Annotation(SlotNumberAID),
|
|
|
|
SlotNum(sn) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Support for the InstNumber annotation
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// This annotation (attached only to Instruction objects) is used to hold the
|
|
|
|
// instruction number of the instruction, and the slot number for the value in
|
|
|
|
// its type plane. InstNumber's are used for user interaction, and for
|
|
|
|
// calculating which value slot to store the result of the instruction in.
|
|
|
|
//
|
2002-04-07 20:49:59 +00:00
|
|
|
// Instructions have this annotation attached to them when the containing
|
2003-05-08 16:18:31 +00:00
|
|
|
// function has it's FunctionInfo created (by the FunctionInfo ctor).
|
2001-08-23 17:05:04 +00:00
|
|
|
//
|
|
|
|
struct InstNumber : public SlotNumber {
|
|
|
|
unsigned InstNum; // Ranges from 1->
|
|
|
|
|
|
|
|
InstNumber(unsigned in, unsigned sn) : SlotNumber(sn), InstNum(in) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Support for the Breakpoint annotation
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
static AnnotationID BreakpointAID(
|
|
|
|
AnnotationManager::getID("Interpreter::Breakpoint"));
|
|
|
|
// Just use an Annotation directly, Breakpoint is currently just a marker
|
|
|
|
|
2001-10-15 05:51:48 +00:00
|
|
|
|
2001-08-23 17:05:04 +00:00
|
|
|
#endif
|