[LLVMdev] About clock and wait instruction

Chris Lattner sabre at nondot.org
Thu Dec 18 21:56:01 PST 2003

On Fri, 19 Dec 2003, Yueqiang wrote:

> hi,
> like in C/C++ language there are time/date and istream::sync function.

If an operation can be written in C/C++ or some other high-level language,
then it should be.  It can be directly compiled to LLVM bytecode.  In our
case you can llvm-dis llvm-gcc/lib/libstdc++.so to see what we compile it

> also in RISC system Data/Inst Cache synchronize etc.

The only reason to sync the icache is when doing self modifying code and
stuff like that.  In LLVM, we expose structured and portable ways doing
this, which automatically take care of flushing the icache as necessary.
If you have questions about this, I'm sure Misha or Brian can fill you in
on it.

I'm not sure why you would want to flush the dcache.  More often you want
to use synchronized operations or something like that.  Currently we do
little more than let programs use pthreads or some other threading
library, but we do intend to eventually add first-class synchronization
support to LLVM.  This will develop as there is a need.


> ----- Original Message -----
> From: "Chris Lattner" <sabre at nondot.org>
> To: "Yueqiang" <qiangyue at ict.ac.cn>
> Cc: "LLVM Developers List" <llvmdev at cs.uiuc.edu>
> Sent: Friday, December 19, 2003 10:25 AM
> Subject: Re: [LLVMdev] About clock and wait instruction
> > On Fri, 19 Dec 2003, Yueqiang wrote:
> >
> > > In high level languge there are usually have time and sync instruction,
> > > to handle async and sync operation.
> > > I want to know how LLVM take an count of these.
> >
> > I'm not sure exactly what 'time' and 'sync' operations you're talking
> > about, or what languages support them.   However, LLVM is designed to make
> > it trivial to interface to libraries and routines written in other
> > languages.  This means that (even if LLVM should be extended to support
> > these operations eventually) you can always write them in assembly or
> > whatever, then call them from LLVM.
> >
> > Note however that LLVM is _not_ a high-level language, and in fact we do
> > not explicitly support _many_ features of HLLs directly in LLVM.  We use a
> > strategy of representing the key components of the high-level ideas using
> > low-level primitives that can be used for a variety of purposes.  If you
> > describe what the time/sync operations are, maybe I can sketch out a
> > suggested mapping for you.
> >
> > -Chris
> >
> > --
> > http://llvm.cs.uiuc.edu/
> > http://www.nondot.org/~sabre/Projects/
> >
> >



More information about the llvm-dev mailing list