Commit 6638be02 authored by Manuel Mohr's avatar Manuel Mohr
Browse files

Added callback mechanism to determine compilerlib function names.

parent e599bf38
......@@ -1082,6 +1082,29 @@ FIRM_API ir_value_classify_sign classify_value_sign(ir_node *n);
FIRM_API ir_tarval *computed_value_Cmp_Confirm(
const ir_node *cmp, ir_node *left, ir_node *right, ir_relation relation);
typedef ir_entity *(*compilerlib_entity_creator_t)(ident *id, ir_type *mt);
/**
* Set the compilerlib entity creation callback that is used to create
* compilerlib function entities.
*
* @param cb the new compilerlib entity creation callback
*/
FIRM_API void set_compilerlib_entity_creator(compilerlib_entity_creator_t c);
/**
* Get the compilerlib entity creation callback.
*/
FIRM_API compilerlib_entity_creator_t get_compilerlib_entity_creator();
/**
* Construct the entity for a given function using the current compilerlib
* entity creation callback.
*
* @param id the identifier of the compilerlib function
* @param mt the method type of the compilerlib function
*/
FIRM_API ir_entity *create_compilerlib_entity(ident *id, ir_type *mt);
#include "end.h"
#endif
/*
* Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in the
* packaging of this file.
*
* Licensees holding valid libFirm Professional Edition licenses may use
* this file in accordance with the libFirm Commercial License.
* Agreement provided with the Software.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE.
*/
/**
* @file
* @brief Compilerlib entity creation related functions.
* @date 2011-09-22
* @author Manuel Mohr
* @version $Id$
*/
#include "config.h"
#include "irprog.h"
#include "iroptimize.h"
#include "typerep.h"
#include <stddef.h>
#include <assert.h>
/* The default implementation does not set a different ld name. */
static ir_entity *compilerlib_entity_def_creator(ident *id, ir_type *mt)
{
return new_entity(get_glob_type(), id, mt);
}
static compilerlib_entity_creator_t creator = compilerlib_entity_def_creator;
void set_compilerlib_entity_creator(compilerlib_entity_creator_t c)
{
assert(c != NULL);
creator = c;
}
compilerlib_entity_creator_t get_compilerlib_entity_creator()
{
return creator;
}
ir_entity *create_compilerlib_entity(ident *id, ir_type *mt)
{
return creator(id, mt);
}
......@@ -187,12 +187,10 @@ static ir_node *get_memcpy_symconst(ir_graph *irg)
{
ident *id = new_id_from_str("memcpy");
ir_type *mt = get_memcpy_methodtype();
ir_entity *ent = new_entity(get_glob_type(), id, mt);
ir_entity *ent = create_compilerlib_entity(id, mt);
symconst_symbol sym;
set_entity_ld_ident(ent, get_entity_ident(ent));
sym.entity_p = ent;
return new_r_SymConst(irg, mode_P_code, sym, symconst_addr_ent);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment