ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
Last change
on this file since 258eb5c9 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago |
licencing: seventh groups of files
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[0dd3a2f] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
| 7 | // CodeGenVisitor.cc --
|
---|
| 8 | //
|
---|
| 9 | // Author : Richard C. Bilson
|
---|
| 10 | // Created On : Mon May 18 07:44:20 2015
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Mon May 18 07:57:51 2015
|
---|
| 13 | // Update Count : 3
|
---|
| 14 | //
|
---|
| 15 |
|
---|
[51b73452] | 16 | #include <iostream>
|
---|
| 17 | #include <list>
|
---|
| 18 |
|
---|
| 19 | #include "Statement.h"
|
---|
| 20 | #include "Expression.h"
|
---|
| 21 | #include "CodeGenVisitor.h"
|
---|
| 22 | using namespace std;
|
---|
| 23 |
|
---|
[a08ba92] | 24 | void CodeGenVisitor::visit( Type *type ) { }
|
---|
[0dd3a2f] | 25 | void CodeGenVisitor::visit( BasicType *basicType ) { }
|
---|
[51b73452] | 26 |
|
---|
[0dd3a2f] | 27 | void CodeGenVisitor::visit( Constant *constant ) {
|
---|
| 28 | cout << constant->get_value() << endl;
|
---|
[51b73452] | 29 | }
|
---|
| 30 |
|
---|
[a08ba92] | 31 | void CodeGenVisitor::visit( Expression *expr ) { }
|
---|
[51b73452] | 32 |
|
---|
[0dd3a2f] | 33 | void CodeGenVisitor::visit( ConstantExpr *cnst ) {
|
---|
| 34 | if ( cnst != 0 )
|
---|
| 35 | visit(cnst->get_constant());
|
---|
[51b73452] | 36 | }
|
---|
| 37 |
|
---|
[0dd3a2f] | 38 | void CodeGenVisitor::visit( Statement *stmt ) { }
|
---|
[51b73452] | 39 |
|
---|
[0dd3a2f] | 40 | void CodeGenVisitor::visit( ExprStmt *exprStmt ) {
|
---|
| 41 | if ( exprStmt != 0 )
|
---|
| 42 | exprStmt->get_expr()->accept( *this ); // visit(exprStmt->get_expr()) doesn't work
|
---|
[51b73452] | 43 | }
|
---|
| 44 |
|
---|
[0dd3a2f] | 45 | void CodeGenVisitor::visit( SwitchStmt *switchStmt ) {
|
---|
| 46 | cout << "switch (" << endl;
|
---|
| 47 | // visit(switchStmt->get_condition()); // why doesn't this work?
|
---|
| 48 | switchStmt->get_condition()->accept(*this);
|
---|
[51b73452] | 49 |
|
---|
[0dd3a2f] | 50 | cout << ") {" << endl;
|
---|
| 51 | // visit(switchStmt->get_body()); // why doesn't this work?
|
---|
| 52 | cout << "}" << endl;
|
---|
[51b73452] | 53 | }
|
---|
| 54 |
|
---|
[0dd3a2f] | 55 | // Local Variables: //
|
---|
| 56 | // tab-width: 4 //
|
---|
| 57 | // mode: c++ //
|
---|
| 58 | // compile-command: "make install" //
|
---|
| 59 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.