ctrump/common/bitmap.c File Reference

ビットマップ処理ルーチン More...

#include "ctrump/common/bitmap.h"
#include "ctrump/common/mempool.h"
#include <string.h>
#include <stdio.h>

Include dependency graph for bitmap.c:

Go to the source code of this file.

Defines

#define GEN_OP2(name, OP)
#define OR(d, l, r)   (d) = (l) | (r)
#define NOR(d, l, r)   (d) = (l) | ~(r)
#define NAND(d, l, r)   (d) = (l) & ~(r)
#define AND(d, l, r)   (d) = (l) & (r)
#define GEN_OP3(name, OP)
#define NAND_OR(d, s0, s1, s2)   (d) = (((s0)&~(s1)) | (s2))

Functions

static void clear_unused_bit (ctrump_bitmap_t bmp, unsigned int length)
 length より先にあるビットを消去する
void ctrump_bitmap_copy (ctrump_bitmap_t dest, ctrump_bitmap_t src0, unsigned int length)
int ctrump_bitmap_eq (ctrump_bitmap_t x, ctrump_bitmap_t y, unsigned int length)
void ctrump_bitmap_tostr (char *buf, ctrump_bitmap_t x, unsigned int length)
 文字列へ変換する buf はlength以上の長さを持つこと
int ctrump_print_bitmap_stderr (ctrump_bitmap_t x, unsigned int length)
 ビットマップの文字列表現をstderrへ出力(デバッグ用)
ctrump_bitmap_t ctrump_bmp_zero (unsigned int nbits, struct ctrump_mempool *pool)
 0クリアされたビットマップを割り当てる
ctrump_bitmap_t ctrump_bmp_fill (unsigned int nbits, struct ctrump_mempool *pool)
 全ビットが立ったビットマップを割り当てる
ctrump_bitmap_t ctrump_bmp_alloc (unsigned int nbits, struct ctrump_mempool *pool)
 ビットマップを割り当てる
int ctrump_bitmap_popcnt (ctrump_bitmap_t bmp, unsigned int length)
 立っているビットの数を数える


Detailed Description

ビットマップ処理ルーチン

Definition in file bitmap.c.


Define Documentation

#define AND ( d,
l,
 )     (d) = (l) & (r)

Definition at line 85 of file bitmap.c.

Referenced by cfront::CAnalyzer::evalConstExpr(), and cfront::CAnalyzer::typeExpr().

#define GEN_OP2 ( name,
OP   ) 

Value:

void                                                    \
name(ctrump_bitmap_t dest,                              \
     ctrump_bitmap_t src0,                              \
     ctrump_bitmap_t src1,                              \
     unsigned int length)                               \
{                                                       \
    unsigned int n = WORDSIZE_OF_BITMAP(length);        \
    unsigned int i;                                     \
    for (i=0; i<n; i++) {                               \
        OP(dest[i],src0[i],src1[i]);                    \
    }                                                   \
}

Definition at line 54 of file bitmap.c.

#define GEN_OP3 ( name,
OP   ) 

Value:

void                                                    \
name(ctrump_bitmap_t dest,                              \
     ctrump_bitmap_t src0,                              \
     ctrump_bitmap_t src1,                              \
     ctrump_bitmap_t src2,                              \
     unsigned int length)                               \
{                                                       \
    unsigned int n = WORDSIZE_OF_BITMAP(length);        \
    unsigned int i;                                     \
    for (i=0; i<n; i++) {                               \
        OP(dest[i],src0[i],src1[i],src2[i]);            \
    }                                                   \
}

Definition at line 92 of file bitmap.c.

#define NAND ( d,
l,
 )     (d) = (l) & ~(r)

Definition at line 84 of file bitmap.c.

#define NAND_OR ( d,
s0,
s1,
s2   )     (d) = (((s0)&~(s1)) | (s2))

Definition at line 107 of file bitmap.c.

#define NOR ( d,
l,
 )     (d) = (l) | ~(r)

Definition at line 83 of file bitmap.c.

#define OR ( d,
l,
 )     (d) = (l) | (r)

Definition at line 82 of file bitmap.c.

Referenced by cfront::CAnalyzer::evalConstExpr(), and cfront::CAnalyzer::typeExpr().


Function Documentation

static void clear_unused_bit ( ctrump_bitmap_t  bmp,
unsigned int  length 
) [static]

length より先にあるビットを消去する

Definition at line 45 of file bitmap.c.

References BITMAP_NUM_BITS.

Referenced by ctrump_bitmap_popcnt().

void ctrump_bitmap_copy ( ctrump_bitmap_t  dest,
ctrump_bitmap_t  src0,
unsigned int  length 
)

Definition at line 70 of file bitmap.c.

References WORDSIZE_OF_BITMAP.

Referenced by calc_df(), ctrump_find_iv_node(), and insert_phi().

int ctrump_bitmap_eq ( ctrump_bitmap_t  x,
ctrump_bitmap_t  y,
unsigned int  length 
)

Definition at line 112 of file bitmap.c.

References WORDSIZE_OF_BITMAP.

Referenced by calc_df().

int ctrump_bitmap_popcnt ( ctrump_bitmap_t  bmp,
unsigned int  length 
)

立っているビットの数を数える

Definition at line 205 of file bitmap.c.

References clear_unused_bit(), and WORDSIZE_OF_BITMAP.

Referenced by bitmap_pop(), insert_phi(), and recog_reduction().

void ctrump_bitmap_tostr ( char *  buf,
ctrump_bitmap_t  x,
unsigned int  length 
)

文字列へ変換する buf はlength以上の長さを持つこと

Definition at line 137 of file bitmap.c.

References ctrump_bitmap_p().

Referenced by ctrump_print_bitmap_stderr().

ctrump_bitmap_t ctrump_bmp_alloc ( unsigned int  nbits,
struct ctrump_mempool pool 
)

ビットマップを割り当てる

Definition at line 197 of file bitmap.c.

References BYTESIZE_OF_BITMAP, and ctrump_mempool_alloc.

Referenced by recog_reduction().

ctrump_bitmap_t ctrump_bmp_fill ( unsigned int  nbits,
struct ctrump_mempool pool 
)

全ビットが立ったビットマップを割り当てる

Definition at line 181 of file bitmap.c.

References BYTESIZE_OF_BITMAP, ctrump_mempool_alloc, and WORDSIZE_OF_BITMAP.

ctrump_bitmap_t ctrump_bmp_zero ( unsigned int  nbits,
struct ctrump_mempool pool 
)

0クリアされたビットマップを割り当てる

Definition at line 165 of file bitmap.c.

References BYTESIZE_OF_BITMAP, ctrump_mempool_alloc, and WORDSIZE_OF_BITMAP.

int ctrump_print_bitmap_stderr ( ctrump_bitmap_t  x,
unsigned int  length 
)

ビットマップの文字列表現をstderrへ出力(デバッグ用)

Definition at line 152 of file bitmap.c.

References ctrump_bitmap_tostr().


Generated on Tue Mar 31 20:19:24 2009 for ctrump by  doxygen 1.5.6