c6cabdfce91ec144aa8302d77b52088727e6ec30
[oota-llvm.git] / projects / Stacker / lib / runtime / stacker_rt.c
1 //===-- stacker_rt.c - Runtime Suppor For Stacker Compiler ------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and donated to the LLVM research 
6 // group and is distributed under the University of Illinois Open Source 
7 // License. See LICENSE.TXT for details.
8 // 
9 //===----------------------------------------------------------------------===//
10 //
11 //  This file defines a stack dumping function that can be used for debugging.
12 //  It is called whenever the DUMP built-in word is used in the Stacker source.
13 //  It has no effect on the stack (other than to print it).
14 //
15 //  The real reason this is here is to test LLVM's ability to link with
16 //  separately compiled software.
17 //
18 //===----------------------------------------------------------------------===//
19
20 #include "stdio.h"
21
22 extern long _index_;
23 extern int _stack_[1024];
24
25 void
26 _stacker_dump_stack_()
27 {
28     int i;
29     printf("Stack Dump:\n");
30     for (i = _index_; i > 0; i-- )
31     {
32         printf("#%03d: %d\n", i, _stack_[i] );
33     }
34 }