예제 #1
0
파일: decl.c 프로젝트: JamesLinus/mcc
static node_t *ptr_decl(void)
{
    node_t *ret = NULL;
    int con, vol, res, type;

    cc_assert(token->id == '*');

    for (;;) {
        int *p, t = token->id;
        switch (token->id) {
        case CONST:
            p = &con;
            break;

        case VOLATILE:
            p = &vol;
            break;

        case RESTRICT:
            p = &res;
            break;

        case '*':
        {
            node_t *pty = ptr_type(NULL);
            con = vol = res = type = 0;
            p = &type;
            prepend_type(&ret, pty);
        }
        break;

        default:
            p = NULL;
            break;
        }

        if (p == NULL)
            break;

        if (*p != 0)
            warning("duplicate type qulifier '%s'", token->name);

        *p = t;

        if (t == CONST || t == VOLATILE || t == RESTRICT)
            ret = qual(t, ret);

        gettok();
    }

    return ret;
}
예제 #2
0
inline
/* static */
object_helper::
ptr_type
object_helper::
    get_checked_disp_(
        IDispatch*  p,
        char const* message /* = NULL */
    ) /* const */
    {
        check_disp_(p, message);

        return ptr_type(p, true);
    }
예제 #3
0
  Context::Context(LLVMState* ls)
    : ls_(ls)
    , root_info_(0)
    , inlined_block_(false)
    , inline_depth_(0)
    , rds_(new jit::RuntimeDataHolder)
    , function_(0)
    , state_(0)
    , out_args_(0)
    , counter_(0)
  {
    VoidTy = Type::getVoidTy(ctx_);

    Int1Ty = Type::getInt1Ty(ctx_);
    Int8Ty = Type::getInt8Ty(ctx_);
    Int16Ty = Type::getInt16Ty(ctx_);
    Int32Ty = Type::getInt32Ty(ctx_);
    Int64Ty = Type::getInt64Ty(ctx_);

#ifdef IS_X8664
    IntPtrTy = Int64Ty;
#else
    IntPtrTy = Int32Ty;
#endif

    VoidPtrTy = llvm::PointerType::getUnqual(Int8Ty);

    FloatTy = Type::getFloatTy(ctx_);
    DoubleTy = Type::getDoubleTy(ctx_);

    Int8PtrTy = llvm::PointerType::getUnqual(Int8Ty);

    Zero = llvm::ConstantInt::get(Int32Ty, 0);
    One = llvm::ConstantInt::get(Int32Ty, 1);

    module_ = new llvm::Module("rubinius", ctx_);

    autogen_types::makeLLVMModuleContents(module_);

    llvm::EngineBuilder factory(module_);

    factory.setAllocateGVsWithCode(false);
    memory_ = new jit::RubiniusRequestJITMemoryManager(ls->memory());
    factory.setJITMemoryManager(memory_);

#if RBX_LLVM_API_VER > 300
    llvm::TargetOptions opts;
    opts.NoFramePointerElim = true;
    opts.NoFramePointerElimNonLeaf = true;

    factory.setTargetOptions(opts);
#endif

    engine_ = factory.create();
    if(ls_->jit_event_listener()) {
      engine_->RegisterJITEventListener(ls_->jit_event_listener());
    }

    builder_ = new llvm::PassManagerBuilder();
    builder_->OptLevel = 2;
    passes_ = new llvm::FunctionPassManager(module_);

#if RBX_LLVM_API_VER >= 302
    module_->setDataLayout(engine_->getDataLayout()->getStringRepresentation());
    passes_->add(new llvm::DataLayout(*engine_->getDataLayout()));
#else
    module_->setDataLayout(engine_->getTargetData()->getStringRepresentation());
    passes_->add(new llvm::TargetData(*engine_->getTargetData()));
#endif

    builder_->populateFunctionPassManager(*passes_);

    // Eliminate unnecessary alloca.
    passes_->add(createPromoteMemoryToRegisterPass());
    // Do simple "peephole" optimizations and bit-twiddling optzns.
    passes_->add(createInstructionCombiningPass());
    // Reassociate expressions.
    passes_->add(createReassociatePass());
    // Eliminate Common SubExpressions.
    passes_->add(createGVNPass());
    passes_->add(createDeadStoreEliminationPass());

    passes_->add(createInstructionCombiningPass());

    // Simplify the control flow graph (deleting unreachable blocks, etc).
    passes_->add(createCFGSimplificationPass());

    passes_->add(create_rubinius_alias_analysis());
    passes_->add(createGVNPass());
    // passes_->add(createCFGSimplificationPass());
    passes_->add(createDeadStoreEliminationPass());
    // passes_->add(createVerifierPass());
    passes_->add(createScalarReplAggregatesPass());

    passes_->add(create_overflow_folding_pass());
    passes_->add(create_guard_eliminator_pass());

    passes_->add(createCFGSimplificationPass());
    passes_->add(createInstructionCombiningPass());
    passes_->add(createScalarReplAggregatesPass());
    passes_->add(createDeadStoreEliminationPass());
    passes_->add(createCFGSimplificationPass());
    passes_->add(createInstructionCombiningPass());
    passes_->doInitialization();

    ObjTy = ptr_type("Object");

    profiling_ = new GlobalVariable(
        *module_, Int1Ty, false,
        GlobalVariable::ExternalLinkage,
        0, "profiling_flag");

    metadata_id_ = ctx_.getMDKindID("rbx-classid");
  }
예제 #4
0
파일: qgitref.cpp 프로젝트: KDE/libqgit2
void Reference::setTarget(const OId& oid, const Signature &signature, const QString &message)
{
    git_reference* rp;
    qGitThrow(git_reference_set_target(&rp, data(), oid.constData(), signature.data(), message.toUtf8()));
    d = ptr_type(rp, git_reference_free);
}
예제 #5
0
파일: qgitref.cpp 프로젝트: KDE/libqgit2
void Reference::setSymbolicTarget(const QString& target, const Signature &signature, const QString &message)
{
    git_reference* rp;
    qGitThrow(git_reference_symbolic_set_target(&rp, data(), PathCodec::toLibGit2(target), signature.data(), message.toUtf8()));
    d = ptr_type(rp, git_reference_free);
}
예제 #6
0
 cached_msg(const string_type & str, bool prepended_)
   : msg(new string_type(str)), prepended(prepended_), id( ptr_type() ), is_new(true) {}
예제 #7
0
 cached_msg() : prepended(true), id( ptr_type() ), is_new(true) {}