C++ ArrayRef::begin方法代码示例

本文整理汇总了C++中llvm::ArrayRef::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayRef::begin方法的具体用法?C++ ArrayRef::begin怎么用?C++ ArrayRef::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在llvm::ArrayRef的用法示例。


C++ ArrayRef::begin方法代码示例

在下文中一共展示了ArrayRef::begin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AcceptedChanges

NullptrFixer::NullptrFixer(unsigned &AcceptedChanges,
                           llvm::ArrayRef<llvm::StringRef> UserMacros,
                           Transform &Owner)
    : AcceptedChanges(AcceptedChanges), Owner(Owner) {
    UserNullMacros.insert(UserNullMacros.begin(), UserMacros.begin(),
                          UserMacros.end());
    UserNullMacros.insert(UserNullMacros.begin(), llvm::StringRef(NullMacroName));
}
开发者ID:dongAxis,项目名称:clang-700.0.72,代码行数:8,代码来源:NullptrActions.cpp

示例2:

UnknownSyntax
SyntaxFactory::makeUnknownSyntax(llvm::ArrayRef<RC<TokenSyntax>> Tokens) {
  RawSyntax::LayoutList Layout;
  std::copy(Tokens.begin(), Tokens.end(), std::back_inserter(Layout));
  auto Raw = RawSyntax::make(SyntaxKind::Unknown, Layout,
                             SourcePresence::Present);
  auto Data = UnknownSyntaxData::make(Raw);
  return { Data, Data.get() };
}
开发者ID:KoKumagai,项目名称:swift,代码行数:9,代码来源:SyntaxFactory.cpp

示例3: printNameList

void printNameList(llvm::raw_ostream &out, llvm::ArrayRef<ObjectPtr> x, llvm::ArrayRef<unsigned> dispatchIndices)
{
    for (size_t i = 0; i < x.size(); ++i) {
        if (i != 0)
            out << ", ";
        if (find(dispatchIndices.begin(), dispatchIndices.end(), i) != dispatchIndices.end())
            out << "*";
        printName(out, x[i]);
    }
}
开发者ID:DawidvC,项目名称:clay,代码行数:10,代码来源:printer.cpp

示例4: lookup

// Returns qualified names of symbols with any of IDs in the index.
std::vector<std::string> lookup(const SymbolIndex &I,
                                llvm::ArrayRef<SymbolID> IDs) {
  LookupRequest Req;
  Req.IDs.insert(IDs.begin(), IDs.end());
  std::vector<std::string> Results;
  I.lookup(Req, [&](const Symbol &Sym) {
    Results.push_back(getQualifiedName(Sym));
  });
  return Results;
}
开发者ID:ingowald,项目名称:llvm-project,代码行数:11,代码来源:TestIndex.cpp

示例5: emitWarning

void emitWarning(const char* warning_msg,
		 llvm::ArrayRef<llvm::Value*> extra_args,
		 Compiler* compiler)
{
    std::vector<llvm::Value*> args;
    args.push_back(compiler->emitConstantPointer(warning_msg));
    args.insert(args.end(), extra_args.begin(), extra_args.end());

    Function* warning = getDeclaration("Rf_warning", compiler);
    compiler->emitCallOrInvoke(warning, args);
}
开发者ID:jeffreyhorner,项目名称:cxxr,代码行数:11,代码来源:Runtime.cpp

示例6: emitError

void emitError(const char* error_msg, llvm::ArrayRef<llvm::Value*> extra_args,
	       Compiler* compiler)
{
    std::vector<llvm::Value*> args;
    args.push_back(compiler->emitConstantPointer(error_msg));
    args.insert(args.end(), extra_args.begin(), extra_args.end());

    Function* error = getDeclaration("Rf_error", compiler);
    compiler->emitCallOrInvoke(error, args);
    compiler->CreateUnreachable();
}
开发者ID:jeffreyhorner,项目名称:cxxr,代码行数:11,代码来源:Runtime.cpp

示例7: addGlobals

void addGlobals(ModulePtr m, llvm::ArrayRef<TopLevelItemPtr>  toplevels) {
    TopLevelItemPtr const *i, *end;
    for (i = toplevels.begin(), end = toplevels.end();
    i != end; ++i) {
        m->topLevelItems.push_back(*i);
        TopLevelItem *x = i->ptr();
        x->env = m->env;
        switch (x->objKind) {
        case ENUM_DECL : {
                EnumDecl *enumer = (EnumDecl *)x;
                TypePtr t = enumType(enumer);
                addGlobal(m, enumer->name, enumer->visibility, t.ptr());
                for (unsigned i = 0 ; i < enumer->members.size(); ++i) {
                    EnumMember *member = enumer->members[i].ptr();
                    member->index = (int)i;
                    member->type = t;
                    addGlobal(m, member->name, enumer->visibility, member);
                }
                break;
            }
        case PROCEDURE : {
                Procedure *proc = (Procedure *)x;
                if (proc->interface != NULL)
                    proc->interface->env = m->env;
                // fallthrough
            }
        default :
                if (x->name.ptr())
                    addGlobal(m, x->name, x->visibility, x);
        break;
    }

    }

    llvm::ArrayRef<TopLevelItemPtr> items = m->topLevelItems;
    for (size_t i = items.size() - toplevels.size(); i < items.size(); ++i) {
        Object *obj = items[i].ptr();
        switch (obj->objKind) {
        case OVERLOAD :
            initOverload((Overload *)obj);
            break;
        case INSTANCE_DECL :
            initVariantInstance((InstanceDecl *)obj);
            break;
        case STATIC_ASSERT_TOP_LEVEL:
            checkStaticAssert((StaticAssertTopLevel *)obj);
            break;
        default:
            break;
        }
    }

}
开发者ID:Blei,项目名称:clay,代码行数:53,代码来源:loader.cpp

示例8: circularImportsError

static void circularImportsError(llvm::ArrayRef<string>  modules) {
    string s;
    llvm::raw_string_ostream ss(s);
    ss << "import loop:\n";
    for (string const *it = modules.begin(); it != modules.end(); ++it) {
        ss << "    " << *it;
        if (it + 1 != modules.end()) {
            // because error() function adds trailing newline
            ss << "\n";
        }
    }
    return error(ss.str());
}
开发者ID:Blei,项目名称:clay,代码行数:13,代码来源:loader.cpp

示例9: ConvertValuesToUnsigned

// Some interfaces to LLVM builder require unsigned indices instead of a vector.
// i.e. llvm::IRBuilder::CreateExtractValue()
// This method will do the conversion and inform the caller if not every element was
// a constant integer.
bool ConvertValuesToUnsigned(unsigned* indices, int &count, llvm::ArrayRef<llvm::Value*> chain)
{
    llvm::ArrayRef<llvm::Value*>::iterator start = chain.begin();

    for (count = 0; start != chain.end(); ++start, ++count) {
        if (llvm::Constant* constant = llvm::dyn_cast<llvm::Constant>(*start)) {
            if (llvm::ConstantInt *constantInt = llvm::dyn_cast<llvm::ConstantInt>(constant))
                indices[count] = constantInt->getValue().getSExtValue();
            else
                return false;
        } else {
            return false;
        }
    }

    return true;
}
开发者ID:hantempo,项目名称:LunarGLASS,代码行数:21,代码来源:Util.cpp

示例10:

bool
ABISysV_mips::PrepareTrivialCall (Thread &thread,
                                  addr_t sp,
                                  addr_t func_addr,
                                  addr_t return_addr,
                                  llvm::ArrayRef<addr_t> args) const
{
    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));

    if (log)
    {
        StreamString s;
        s.Printf("ABISysV_mips::PrepareTrivialCall (tid = 0x%" PRIx64 ", sp = 0x%" PRIx64 ", func_addr = 0x%" PRIx64 ", return_addr = 0x%" PRIx64,
                    thread.GetID(),
                    (uint64_t)sp,
                    (uint64_t)func_addr,
                    (uint64_t)return_addr);

        for (size_t i = 0; i < args.size(); ++i)
            s.Printf (", arg%zd = 0x%" PRIx64, i + 1, args[i]);
        s.PutCString (")");
        log->PutCString(s.GetString().c_str());
    }

    RegisterContext *reg_ctx = thread.GetRegisterContext().get();
    if (!reg_ctx)
        return false;

    const RegisterInfo *reg_info = NULL;

    RegisterValue reg_value;

    // Argument registers
    const char *reg_names[] = { "r4", "r5", "r6", "r7" };

    llvm::ArrayRef<addr_t>::iterator ai = args.begin(), ae = args.end();

    // Write arguments to registers
    for (size_t i = 0; i < llvm::array_lengthof(reg_names); ++i)
    {
        if (ai == ae)
            break;

        reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
        if (log)
            log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);

        if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
            return false;

        ++ai;
    }

    // If we have more than 4 arguments --Spill onto the stack
    if (ai != ae)
    {
        // No of arguments to go on stack 
        size_t num_stack_regs = args.size();

        // Allocate needed space for args on the stack
        sp -= (num_stack_regs * 4);

        // Keep the stack 8 byte aligned
        sp &= ~(8ull-1ull);

        // just using arg1 to get the right size
        const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1);
        
        addr_t arg_pos = sp+16;
        
        size_t i = 4;
        for (; ai != ae; ++ai)
        {
            reg_value.SetUInt32(*ai);
            if (log)
                log->Printf("About to write arg%zd (0x%" PRIx64 ") at  0x%" PRIx64 "", i+1, args[i], arg_pos);
            
            if (reg_ctx->WriteRegisterValueToMemory(reg_info, arg_pos, reg_info->byte_size, reg_value).Fail())
                return false;
            arg_pos += reg_info->byte_size;
            i++;
        }
    }

    Error error;
    const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
    const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
    const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);

    if (log)
    log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);

    // Set "sp" to the requested value
    if (!reg_ctx->WriteRegisterFromUnsigned (sp_reg_info, sp))
        return false;

    if (log)
    log->Printf("Writing RA: 0x%" PRIx64, (uint64_t)return_addr);

    // Set "ra" to the return address
//.........这里部分代码省略.........
开发者ID:kleopatra999,项目名称:lldb,代码行数:101,代码来源:ABISysV_mips.cpp

示例11: target_sp

bool
ABIMacOSX_arm::PrepareTrivialCall (Thread &thread, 
                                   addr_t sp, 
                                   addr_t function_addr, 
                                   addr_t return_addr, 
                                   llvm::ArrayRef<addr_t> args) const
{
    RegisterContext *reg_ctx = thread.GetRegisterContext().get();
    if (!reg_ctx)
        return false;    

    const uint32_t pc_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
    const uint32_t sp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
    const uint32_t ra_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);

    RegisterValue reg_value;

    const char *reg_names[] = { "r0", "r1", "r2", "r3" };
    
    llvm::ArrayRef<addr_t>::iterator ai = args.begin(), ae = args.end();
    
    for (size_t i = 0; i < llvm::array_lengthof(reg_names); ++i)
    {
        if (ai == ae)
            break;
        
        reg_value.SetUInt32(*ai);
        if (!reg_ctx->WriteRegister(reg_ctx->GetRegisterInfoByName(reg_names[i]), reg_value))
            return false;
        
        ++ai;
    }
    
    if (ai != ae)
    {
        // Spill onto the stack
        size_t num_stack_regs = ae - ai;
        
        sp -= (num_stack_regs * 4);
        // Keep the stack 8 byte aligned, not that we need to
        sp &= ~(8ull-1ull);
        
        // just using arg1 to get the right size
        const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1);
        
        addr_t arg_pos = sp;
        
        for (; ai != ae; ++ai)
        {
            reg_value.SetUInt32(*ai);
            if (reg_ctx->WriteRegisterValueToMemory(reg_info, arg_pos, reg_info->byte_size, reg_value).Fail())
                return false;
            arg_pos += reg_info->byte_size;
        }
    }
    
    TargetSP target_sp (thread.CalculateTarget());
    Address so_addr;

    // Figure out if our return address is ARM or Thumb by using the 
    // Address::GetCallableLoadAddress(Target*) which will figure out the ARM
    // thumb-ness and set the correct address bits for us.
    so_addr.SetLoadAddress (return_addr, target_sp.get());
    return_addr = so_addr.GetCallableLoadAddress (target_sp.get());

    // Set "lr" to the return address
    if (!reg_ctx->WriteRegisterFromUnsigned (ra_reg_num, return_addr))
        return false;

    // Set "sp" to the requested value
    if (!reg_ctx->WriteRegisterFromUnsigned (sp_reg_num, sp))
        return false;
    
    // If bit zero or 1 is set, this must be a thumb function, no need to figure
    // this out from the symbols.
    so_addr.SetLoadAddress (function_addr, target_sp.get());
    function_addr = so_addr.GetCallableLoadAddress (target_sp.get());
    
    const RegisterInfo *cpsr_reg_info = reg_ctx->GetRegisterInfoByName("cpsr");
    const uint32_t curr_cpsr = reg_ctx->ReadRegisterAsUnsigned(cpsr_reg_info, 0);

    // Make a new CPSR and mask out any Thumb IT (if/then) bits
    uint32_t new_cpsr = curr_cpsr & ~MASK_CPSR_IT_MASK;
    // If bit zero or 1 is set, this must be thumb...
    if (function_addr & 1ull)
        new_cpsr |= MASK_CPSR_T;    // Set T bit in CPSR
    else
        new_cpsr &= ~MASK_CPSR_T;   // Clear T bit in CPSR

    if (new_cpsr != curr_cpsr)
    {
        if (!reg_ctx->WriteRegisterFromUnsigned (cpsr_reg_info, new_cpsr))
            return false;
    }

    function_addr &= ~1ull;   // clear bit zero since the CPSR will take care of the mode for us
    
    // Set "pc" to the address requested
    if (!reg_ctx->WriteRegisterFromUnsigned (pc_reg_num, function_addr))
        return false;
//.........这里部分代码省略.........
开发者ID:Jean-Daniel,项目名称:lldb,代码行数:101,代码来源:ABIMacOSX_arm.cpp

示例12: _emitPPCall

void JitFragmentWriter::_emitPPCall(RewriterVar* result, void* func_addr, llvm::ArrayRef<RewriterVar*> args,
                                    int num_slots, int slot_size, AST* ast_node) {
    assembler::Register r = allocReg(assembler::R11);

    if (args.size() > 6) { // only 6 args can get passed in registers.
        assert(args.size() <= 6 + JitCodeBlock::num_stack_args);
        for (int i = 6; i < args.size(); ++i) {
            assembler::Register reg = args[i]->getInReg(Location::any(), true);
            assembler->mov(reg, assembler::Indirect(assembler::RSP, sizeof(void*) * (i - 6)));
        }
        RewriterVar::SmallVector reg_args(args.begin(), args.begin() + 6);
        assert(reg_args.size() == 6);
        _setupCall(false, reg_args, RewriterVar::SmallVector());
    } else
        _setupCall(false, args, RewriterVar::SmallVector());

    if (failed)
        return;

    // make sure setupCall doesn't use R11
    assert(vars_by_location.count(assembler::R11) == 0);

    int pp_size = slot_size * num_slots;

    // make space for patchpoint
    uint8_t* pp_start = rewrite->getSlotStart() + assembler->bytesWritten();
    constexpr int call_size = 13;
    assembler->skipBytes(pp_size + call_size);
    uint8_t* pp_end = rewrite->getSlotStart() + assembler->bytesWritten();
    assert(assembler->hasFailed() || (pp_start + pp_size + call_size == pp_end));

    std::unique_ptr<ICSetupInfo> setup_info(
        ICSetupInfo::initialize(true, num_slots, slot_size, ICSetupInfo::Generic, NULL));

    // calculate available scratch space
    int pp_scratch_size = 0;
    int pp_scratch_location = rewrite->getScratchRspOffset() + rewrite->getScratchSize();
    for (int i = rewrite->getScratchSize() - 8; i >= 0; i -= 8) {
        Location l(Location::Scratch, i);
        if (vars_by_location.count(l))
            break;

        pp_scratch_size += 8;
        pp_scratch_location -= 8;
    }

    for (RewriterVar* arg : args) {
        arg->bumpUse();
    }

    assertConsistent();

    StackInfo stack_info(pp_scratch_size, pp_scratch_location);
    pp_infos.emplace_back(PPInfo{ func_addr, pp_start, pp_end, std::move(setup_info), stack_info, ast_node });

    assert(vars_by_location.count(assembler::RAX) == 0);
    result->initializeInReg(assembler::RAX);
    assertConsistent();

    result->releaseIfNoUses();
}
开发者ID:yurenyong123,项目名称:pyston,代码行数:61,代码来源:baseline_jit.cpp

本文标签属性:

示例:示例志愿表

代码:代码零九

ArrayRef:ArrayRef

上一篇:Java Timer.cancel方法代码示例
下一篇:大展宏图的意思是什么?(大展鸿图是什么意思)

为您推荐