aboutsummaryrefslogtreecommitdiffhomepage
path: root/ir
diff options
context:
space:
mode:
Diffstat (limited to 'ir')
-rw-r--r--ir/intrin.c2
-rw-r--r--ir/ir.c6
-rw-r--r--ir/ir.h4
3 files changed, 6 insertions, 6 deletions
diff --git a/ir/intrin.c b/ir/intrin.c
index cd2865a..2ef826c 100644
--- a/ir/intrin.c
+++ b/ir/intrin.c
@@ -24,7 +24,7 @@ intrin(struct block *blk, int *curi, enum intrin in, struct arg *args, int narg,
/* memcpy */
*args[1].ty = *args[0].ty = mktyperef(cls2type(KPTR));
insertinstr(blk, (*curi)++, mkarginstr(cls2type(cls), mkintcon(cls, td->siz)));
- *this = mkinstr(Ocall, 0, mksymref("memcpy"), this->r);
+ *this = mkinstr(Ocall, 0, mksymref("memcpy", 1), this->r);
calltab.p[this->r.i].narg = 3;
calltab.p[this->r.i].ret = cls2type(0);
return 0;
diff --git a/ir/ir.c b/ir/ir.c
index dbd6206..cd93992 100644
--- a/ir/ir.c
+++ b/ir/ir.c
@@ -94,7 +94,7 @@ addcon(const struct xcon *con)
{
uint h = hashb(0, con, sizeof *con);
uint i = h, n = countof(conht);
- assert(con->issym || con->isdat || con->cls);
+ assert((con->issym ^ con->isdat && !(con->isdat && con->isfunc)) || con->cls);
for (;; ++i) {
i &= countof(conht) - 1;
if (!conht[i].issym && !conht[i].isdat && !conht[i].cls) {
@@ -138,9 +138,9 @@ mkfltcon(enum irclass k, double f)
}
union ref
-mksymref(const char *s)
+mksymref(const char *s, bool isfunc)
{
- struct xcon con = { .issym = 1, .sym = s };
+ struct xcon con = { .issym = 1, .sym = s, .isfunc = isfunc };
return mkref(RXCON, addcon(&con));
}
diff --git a/ir/ir.h b/ir/ir.h
index e16cdda..1a1d907 100644
--- a/ir/ir.h
+++ b/ir/ir.h
@@ -26,7 +26,7 @@ struct irdat {
};
struct xcon {
- bool issym, isdat, deref;
+ bool issym, isdat, isfunc, deref;
uchar cls;
union {
const char *sym;
@@ -250,7 +250,7 @@ union ref mkfltcon(enum irclass, double);
#define isaddrcon(r,derefok) ((r).t == RXCON && !conht[(r).i].cls && (derefok || !conht[(r).i].deref))
#define intconval(r) ((r).t == RICON ? (r).i : conht[(r).i].i)
#define fltconval(r) ((r).t == RICON ? (r).i : conht[(r).i].f)
-union ref mksymref(const char *);
+union ref mksymref(const char *, bool isfunc);
union ref mkdatref(const char *name, union type ctype, uint siz, uint align, const void *, uint n, bool deref);
const char *xcon2sym(int ref);
struct instr mkalloca(uint siz, uint align);