comma::CommaRT Class Reference

#include <CommaRT.h>

Collaboration diagram for comma::CommaRT:
Collaboration graph
[legend]

List of all members.

Classes

struct  TypeIdTraits

Public Types

enum  TypeId { CRT_ITable, CRT_DomainInfo, CRT_DomainInstance, CRT_DomainCtor }

Public Member Functions

 CommaRT (CodeGen &CG)
 ~CommaRT ()
CodeGengetCodeGen ()
 Returns the CodeGen object over which this runtime was constructed.
const CodeGengetCodeGen () const
template<TypeId F>
TypeIdTraits< F >::FieldType * getType () const
const std::string & getTypeName (TypeId id) const
llvm::GlobalVariable * registerCapsule (Domoid *domoid)
llvm::Value * getDomain (llvm::IRBuilder<> &builder, llvm::GlobalValue *capsuleInfo) const
llvm::Value * getDomain (llvm::IRBuilder<> &builder, std::vector< llvm::Value * > &args) const
llvm::Value * getLocalCapsule (llvm::IRBuilder<> &builder, llvm::Value *percent, unsigned ID) const
llvm::Value * getCapsuleParameter (llvm::IRBuilder<> &builder, llvm::Value *instance, unsigned index) const
 Returns the formal parameter with the given index.
const DomainInfo * getDomainInfo () const
const DomainInstancegetDomainInstance () const
Exception Handling.

The following methods provide access to the exception handling component of Comma's runtime.



llvm::Constant * registerException (const ExceptionDecl *exception)
 Registers and exception with the runtime.
void raise (SRFrame *frame, const ExceptionDecl *exception, llvm::Value *fileName, llvm::Value *lineNum, llvm::GlobalVariable *message=0)
void raise (SRFrame *frame, const ExceptionDecl *exception, llvm::Value *fileName, llvm::Value *lineNum, llvm::Value *message=0, llvm::Value *length=0)
void reraise (SRFrame *frame, llvm::Value *exception)
 Reraises the given exception object.
void raiseProgramError (SRFrame *frame, llvm::Value *fileName, llvm::Value *lineNum, llvm::GlobalVariable *message) const
 Convinience method to throw a Program_Error.
void raiseConstraintError (SRFrame *frame, llvm::Value *fileName, llvm::Value *lineNum, llvm::GlobalVariable *message) const
 Convinience method to throw a Constraint_Error.
void raiseAssertionError (SRFrame *frame, llvm::Value *fileName, llvm::Value *lineNum, llvm::Value *message, llvm::Value *length) const
 Convinience method to throw a Assertion_Error.
void unhandledException (llvm::IRBuilder<> &builder, llvm::Value *exception) const
llvm::Constant * getEHPersonality () const



llvm::Value * pow_i32_i32 (llvm::IRBuilder<> &builder, llvm::Value *x, llvm::Value *n) const
 Integer exponentiation routines.
llvm::Value * pow_i64_i32 (llvm::IRBuilder<> &builder, llvm::Value *x, llvm::Value *n) const
 Integer exponentiation routines.
Variable stack routines.



void vstack_alloc (llvm::IRBuilder<> &builder, llvm::Value *size) const
void vstack_push (llvm::IRBuilder<> &builder, llvm::Value *data, llvm::Value *size) const
 Pushes size bytes from data onto the variable stack.
void vstack_pop (llvm::IRBuilder<> &builder) const
 Pops the last item pushed from the variable stack.
llvm::Value * vstack (llvm::IRBuilder<> &builder, const llvm::Type *ptrTy) const
Memory allocation routines.



llvm::Value * comma_alloc (llvm::IRBuilder<> &builder, uint64_t size, unsigned alignment) const
llvm::Value * comma_alloc (llvm::IRBuilder<> &builder, llvm::Value *size, unsigned alignment) const

Detailed Description

Definition at line 30 of file CommaRT.h.


Member Enumeration Documentation

Enumerator:
CRT_ITable 
CRT_DomainInfo 
CRT_DomainInstance 
CRT_DomainCtor 

Definition at line 42 of file CommaRT.h.


Constructor & Destructor Documentation

CommaRT::CommaRT ( CodeGen CG  ) 

Definition at line 28 of file CommaRT.cpp.

CommaRT::~CommaRT (  ) 

Definition at line 57 of file CommaRT.cpp.


Member Function Documentation

llvm::Value * CommaRT::comma_alloc ( llvm::IRBuilder<> &  builder,
llvm::Value *  size,
unsigned  alignment 
) const

Definition at line 527 of file CommaRT.cpp.

llvm::Value * CommaRT::comma_alloc ( llvm::IRBuilder<> &  builder,
uint64_t  size,
unsigned  alignment 
) const

Definition at line 513 of file CommaRT.cpp.

llvm::Value * CommaRT::getCapsuleParameter ( llvm::IRBuilder<> &  builder,
llvm::Value *  instance,
unsigned  index 
) const

Returns the formal parameter with the given index.

Returns the formal parameter from the given domain instance with the given index.

Definition at line 550 of file CommaRT.cpp.

const CodeGen& comma::CommaRT::getCodeGen (  )  const [inline]

Definition at line 40 of file CommaRT.h.

CodeGen& comma::CommaRT::getCodeGen (  )  [inline]

Returns the CodeGen object over which this runtime was constructed.

Definition at line 39 of file CommaRT.h.

llvm::Value * CommaRT::getDomain ( llvm::IRBuilder<> &  builder,
std::vector< llvm::Value * > &  args 
) const

Definition at line 304 of file CommaRT.cpp.

llvm::Value * CommaRT::getDomain ( llvm::IRBuilder<> &  builder,
llvm::GlobalValue *  capsuleInfo 
) const

Definition at line 298 of file CommaRT.cpp.

const DomainInfo* comma::CommaRT::getDomainInfo (  )  const [inline]

The following methods are not for public consumption. They provide access to objects used in other areas of the runtime codegen system.

Definition at line 78 of file CommaRT.h.

const DomainInstance* comma::CommaRT::getDomainInstance (  )  const [inline]

Definition at line 79 of file CommaRT.h.

llvm::Constant * CommaRT::getEHPersonality (  )  const

Returns an opaque reference to the exception handling personality routine. Suitable for use as an argument to llvm.eh.selector.

Definition at line 434 of file CommaRT.cpp.

llvm::Value * CommaRT::getLocalCapsule ( llvm::IRBuilder<> &  builder,
llvm::Value *  percent,
unsigned  ID 
) const

Definition at line 543 of file CommaRT.cpp.

template<TypeId F>
TypeIdTraits<F>::FieldType* comma::CommaRT::getType (  )  const [inline]
const std::string & CommaRT::getTypeName ( TypeId  id  )  const

Definition at line 63 of file CommaRT.cpp.

llvm::Value * CommaRT::pow_i32_i32 ( llvm::IRBuilder<> &  builder,
llvm::Value *  x,
llvm::Value *  n 
) const

Integer exponentiation routines.

Definition at line 474 of file CommaRT.cpp.

llvm::Value * CommaRT::pow_i64_i32 ( llvm::IRBuilder<> &  builder,
llvm::Value *  x,
llvm::Value *  n 
) const

Integer exponentiation routines.

Definition at line 480 of file CommaRT.cpp.

void CommaRT::raise ( SRFrame frame,
const ExceptionDecl exception,
llvm::Value *  fileName,
llvm::Value *  lineNum,
llvm::Value *  message = 0,
llvm::Value *  length = 0 
)

Throws an exception.

Calls registerException on the provided exception declaration, then generates code for a raise. fileName is an i8* yeilding the name of the file or module the exception is raised in and lineNum is the corresponding line number. message is a Comma vector (one dimension) of type String and length is its length (an i32). The supplied vector may be null.

Note:
For compiler generated exceptions it is always preferable to raise using a static global as the runtime can avoid a copy of the message data in that case.

Definition at line 345 of file CommaRT.cpp.

void CommaRT::raise ( SRFrame frame,
const ExceptionDecl exception,
llvm::Value *  fileName,
llvm::Value *  lineNum,
llvm::GlobalVariable *  message = 0 
)

Throws an exception.

Calls registerException on the provided exception declaration, then generates code for a raise. fileName is an i8* yeilding the name of the file or module the exception is raised in and lineNum is the corresponding line number. message must be a pointer to a global string of type i8* or null.

Definition at line 337 of file CommaRT.cpp.

void CommaRT::raiseAssertionError ( SRFrame frame,
llvm::Value *  fileName,
llvm::Value *  lineNum,
llvm::Value *  message,
llvm::Value *  length 
) const

Convinience method to throw a Assertion_Error.

Definition at line 426 of file CommaRT.cpp.

void CommaRT::raiseConstraintError ( SRFrame frame,
llvm::Value *  fileName,
llvm::Value *  lineNum,
llvm::GlobalVariable *  message 
) const

Convinience method to throw a Constraint_Error.

Definition at line 418 of file CommaRT.cpp.

void CommaRT::raiseProgramError ( SRFrame frame,
llvm::Value *  fileName,
llvm::Value *  lineNum,
llvm::GlobalVariable *  message 
) const

Convinience method to throw a Program_Error.

Definition at line 411 of file CommaRT.cpp.

llvm::GlobalVariable * CommaRT::registerCapsule ( Domoid domoid  ) 

Definition at line 293 of file CommaRT.cpp.

llvm::Constant * CommaRT::registerException ( const ExceptionDecl exception  ) 

Registers and exception with the runtime.

Given an ExceptionDecl AST node, this method returns an opaque global representing the exception. The first call made to this method with a given ExceptionDecl as argument registers the exception in the system and associates a global as representation. Subsequent calls using the same declaration node return the same global.

Definition at line 439 of file CommaRT.cpp.

void CommaRT::reraise ( SRFrame frame,
llvm::Value *  exception 
)

Reraises the given exception object.

Definition at line 396 of file CommaRT.cpp.

void CommaRT::unhandledException ( llvm::IRBuilder<> &  builder,
llvm::Value *  exception 
) const

Generates a call to _comma_unhandled_exception. This is only called by the main routine when an exception has unwound the entire stack. Its only argument is the unhandled exception object.

A call to _comma_unhandled_exception does not return.

Definition at line 312 of file CommaRT.cpp.

llvm::Value * CommaRT::vstack ( llvm::IRBuilder<> &  builder,
const llvm::Type *  ptrTy 
) const

Returns a pointer to the most recent data pushed onto the variable stack cast to the given type.

Definition at line 503 of file CommaRT.cpp.

void CommaRT::vstack_alloc ( llvm::IRBuilder<> &  builder,
llvm::Value *  size 
) const

Allocates size bytes of uninitialized data onto the vstack (accessable thru vstack()).

Definition at line 486 of file CommaRT.cpp.

void CommaRT::vstack_pop ( llvm::IRBuilder<> &  builder  )  const

Pops the last item pushed from the variable stack.

Definition at line 498 of file CommaRT.cpp.

void CommaRT::vstack_push ( llvm::IRBuilder<> &  builder,
llvm::Value *  data,
llvm::Value *  size 
) const

Pushes size bytes from data onto the variable stack.

Definition at line 491 of file CommaRT.cpp.


The documentation for this class was generated from the following files:

Generated on 1 Feb 2010 for Comma by  doxygen 1.6.1