projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed call generation
[libfirm]
/
ir
/
be
/
beasm_dump_globals.c
diff --git
a/ir/be/beasm_dump_globals.c
b/ir/be/beasm_dump_globals.c
index
77b17a5
..
c94ab4c
100644
(file)
--- a/
ir/be/beasm_dump_globals.c
+++ b/
ir/be/beasm_dump_globals.c
@@
-4,6
+4,15
@@
* @date 19.01.2005
*/
* @date 19.01.2005
*/
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "irprog_t.h"
+#include "type.h"
+#include "xmalloc.h"
+
+
#include "beasm_dump_globals.h"
#include "beasm_dump_globals.h"
@@
-50,13
+59,13
@@
static unsigned highest_bit(unsigned v)
static int ent_is_string_const(entity *ent)
{
int res = 0;
static int ent_is_string_const(entity *ent)
{
int res = 0;
- type *ty;
+
ir_
type *ty;
ty = get_entity_type(ent);
/* if it's an array */
if (is_Array_type(ty)) {
ty = get_entity_type(ent);
/* if it's an array */
if (is_Array_type(ty)) {
- type *elm_ty = get_array_element_type(ty);
+
ir_
type *elm_ty = get_array_element_type(ty);
/* and the array's alement type is primitive */
if (is_Primitive_type(elm_ty)) {
/* and the array's alement type is primitive */
if (is_Primitive_type(elm_ty)) {
@@
-198,10
+207,12
@@
struct arr_info {
*/
static void asm_dump_global ( assembler_t *assembler, entity *ent)
{
*/
static void asm_dump_global ( assembler_t *assembler, entity *ent)
{
-
type *ty
= get_entity_type(ent);
+
ir_type *ty
= get_entity_type(ent);
const char *ld_name = get_entity_ld_name(ent);
const char *ld_name = get_entity_ld_name(ent);
- int align, is_constant, h;
- int i,j,size = 0;
+ int align, /*is_constant,*/ h;
+ int i, /*j,*/ size = 0;
+ ent_variability variability;
+ visibility visibility;
asm_segment_t target_segment = ASM_SEGMENT_DATA_INIT;
asm_segment_t target_segment = ASM_SEGMENT_DATA_INIT;
@@
-210,19
+221,19
@@
static void asm_dump_global ( assembler_t *assembler, entity *ent)
*/
/* ignore methods, they are emitted later */
*/
/* ignore methods, they are emitted later */
- if(is_Method_type(ty))
+ if
(is_Method_type(ty))
return;
/* get the properties of the entity */
return;
/* get the properties of the entity */
-
ent_variability
variability = get_entity_variability(ent);
-
ent_visibility
visibility = get_entity_visibility(ent);
+ variability = get_entity_variability(ent);
+ visibility = get_entity_visibility(ent);
if (variability == variability_constant) {
/* a constant entity, put it into the const segment */
target_segment = ASM_SEGMENT_CONST;
}
if (variability == variability_constant) {
/* a constant entity, put it into the const segment */
target_segment = ASM_SEGMENT_CONST;
}
- /* check, wether it is initialized, if yes create data */
+ /* check, w
h
ether it is initialized, if yes create data */
if (variability != variability_uninitialized ) {
/* if (visibility == visibility_external_visible) {
if (variability != variability_uninitialized ) {
/* if (visibility == visibility_external_visible) {
@@
-262,7
+273,7
@@
static void asm_dump_global ( assembler_t *assembler, entity *ent)
/* potential spare values should be already included! */
for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
entity *step = get_compound_ent_value_member(ent, i);
/* potential spare values should be already included! */
for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
entity *step = get_compound_ent_value_member(ent, i);
- type *stype = get_entity_type(step);
+
ir_
type *stype = get_entity_type(step);
if (get_type_mode(stype)) {
if (get_type_mode(stype)) {
@@
-299,30
+310,30
@@
static void asm_dump_global ( assembler_t *assembler, entity *ent)
*/
type_size = get_type_size_bytes(ty);
*/
type_size = get_type_size_bytes(ty);
- vals = calloc(type_size, sizeof(*vals));
+ vals =
x
calloc(type_size, sizeof(*vals));
/* collect the values and store them at the offsets */
for(i = 0; i < get_compound_ent_n_values(ent); ++i) {
/* collect the values and store them at the offsets */
for(i = 0; i < get_compound_ent_n_values(ent); ++i) {
-
int graph_length, aipos, offset, stepsize
;
+
int graph_length, aipos, offset/*, stepsize*/
;
struct arr_info *ai;
struct arr_info *ai;
- int found = 0;
+ /*int found = 0;*/
int all_n = 1;
int all_n = 1;
- entity *member = get_compound_ent_value_member(ent, i);
+ /*entity *member = get_compound_ent_value_member(ent, i); */
compound_graph_path *path = get_compound_ent_value_path(ent, i);
entity *node = get_compound_graph_path_node(path, 0);
compound_graph_path *path = get_compound_ent_value_path(ent, i);
entity *node = get_compound_graph_path_node(path, 0);
- type *node_type = get_entity_type(node);
+ /*ir_type *node_type = get_entity_type(node);*/
/* get the access path to the costant value */
graph_length = get_compound_graph_path_length(path);
/* get the access path to the costant value */
graph_length = get_compound_graph_path_length(path);
- ai = calloc(graph_length, sizeof(struct arr_info));
+ ai =
x
calloc(graph_length, sizeof(struct arr_info));
/* We wanna know how many arrays are on the path to the entity. We also have to know how
* many elements each array holds to calculate the offset for the entity. */
for (j = 0; j < graph_length; j++) {
/* We wanna know how many arrays are on the path to the entity. We also have to know how
* many elements each array holds to calculate the offset for the entity. */
for (j = 0; j < graph_length; j++) {
- entity *step = get_compound_graph_path_node(path, j);
- type *step_type = get_entity_type(step);
- int ty_size = (get_type_size_bits(step_type) + 7) >> 3;
- int n = 0;
+ entity *step
= get_compound_graph_path_node(path, j);
+
ir_
type *step_type = get_entity_type(step);
+ int ty_size
= (get_type_size_bits(step_type) + 7) >> 3;
+ int n
= 0;
int k;
if (is_Array_type(step_type))
int k;
if (is_Array_type(step_type))
@@
-338,10
+349,10
@@
static void asm_dump_global ( assembler_t *assembler, entity *ent)
if (aipos) aipos--;
for (offset = j = 0; j < graph_length; j++) {
if (aipos) aipos--;
for (offset = j = 0; j < graph_length; j++) {
- entity *step = get_compound_graph_path_node(path, j);
- type *step_type = get_entity_type(step);
- int ent_ofs = get_entity_offset_bytes(step);
- int stepsize = 0;
+ entity *step
= get_compound_graph_path_node(path, j);
+
ir_
type *step_type = get_entity_type(step);
+ int ent_ofs
= get_entity_offset_bytes(step);
+ int stepsize
= 0;
/* add all positive offsets (= offsets in structs) */
if (ent_ofs >= 0) offset += ent_ofs;
/* add all positive offsets (= offsets in structs) */
if (ent_ofs >= 0) offset += ent_ofs;
@@
-427,7
+438,7
@@
static void asm_dump_global ( assembler_t *assembler, entity *ent)
void asm_dump_globals ( assembler_t *assembler ) {
void asm_dump_globals ( assembler_t *assembler ) {
- type *gt = get_glob_type();
+
ir_
type *gt = get_glob_type();
int i, n = get_class_n_members(gt);
for (i = 0; i < n; i++)
int i, n = get_class_n_members(gt);
for (i = 0; i < n; i++)