示例#1
0
void codegen_local_lifetime_end(compile_t* c, const char* name)
{
  compile_frame_t* frame = c->frame;

  compile_local_t k;
  k.name = name;
  size_t index = HASHMAP_UNKNOWN;

  while(frame != NULL)
  {
    compile_local_t* p = compile_locals_get(&frame->locals, &k, &index);

    if(p != NULL && p->alive)
    {
      gencall_lifetime_end(c, p->alloca);
      p->alive = false;
      return;
    }

    if(frame->is_function)
      return;

    frame = frame->prev;
  }
}
示例#2
0
文件: codegen.c 项目: dckc/ponyc
LLVMValueRef codegen_getlocal(compile_t* c, const char* name)
{
  compile_frame_t* frame = c->frame;

  compile_local_t k;
  k.name = name;

  while(frame != NULL)
  {
    compile_local_t* p = compile_locals_get(&frame->locals, &k);

    if(p != NULL)
      return p->alloca;

    if(frame->is_function)
      return NULL;

    frame = frame->prev;
  }

  return NULL;
}