[llvm-commits] [hlvm] r38071 - in /hlvm/trunk: SConstruct hlvm/AST/Pass.h hlvm/AST/SConscript hlvm/AST/SymbolTable.cpp hlvm/Base/SConscript hlvm/Makefile hlvm/Reader/SConscript hlvm/Reader/XML/SConscript hlvm/SConscript hlvm/Writer/SConscript hlvm/Writer/XML/SConscript scons/ scons/__init__.py scons/configure.py scons/environment.py scons/main.py tools/SConscript
Reid Spencer
reid at x10sys.com
Sat Jul 7 16:59:33 PDT 2007
Author: reid
Date: Sat Jul 7 18:59:33 2007
New Revision: 38071
URL: http://llvm.org/viewvc/llvm-project?rev=38071&view=rev
Log:
Initial crack at scons support for HLVM. This has a long way to go.
Added:
hlvm/trunk/SConstruct
hlvm/trunk/hlvm/AST/SConscript
hlvm/trunk/hlvm/Base/SConscript
hlvm/trunk/hlvm/Reader/SConscript
hlvm/trunk/hlvm/Reader/XML/SConscript
hlvm/trunk/hlvm/SConscript
hlvm/trunk/hlvm/Writer/SConscript
hlvm/trunk/hlvm/Writer/XML/SConscript
hlvm/trunk/scons/
hlvm/trunk/scons/__init__.py
hlvm/trunk/scons/configure.py
hlvm/trunk/scons/environment.py
hlvm/trunk/scons/main.py
hlvm/trunk/tools/SConscript
Modified:
hlvm/trunk/hlvm/AST/Pass.h
hlvm/trunk/hlvm/AST/SymbolTable.cpp
hlvm/trunk/hlvm/Makefile
Added: hlvm/trunk/SConstruct
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/SConstruct?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/SConstruct (added)
+++ hlvm/trunk/SConstruct Sat Jul 7 18:59:33 2007
@@ -0,0 +1,11 @@
+# HLVM scons Software Construction Specification
+#
+
+# Set up scons
+import os
+from scons.main import GetBuildEnvironment
+env = GetBuildEnvironment(COMMAND_LINE_TARGETS)
+Export('env')
+
+SConscript('hlvm/SConscript',build_dir=os.path.join(env['BuildDir'],"hlvm"))
+SConscript('tools/SConscript',build_dir=os.path.join(env['BuildDir'],"tools"))
Modified: hlvm/trunk/hlvm/AST/Pass.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Pass.h?rev=38071&r1=38070&r2=38071&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Pass.h (original)
+++ hlvm/trunk/hlvm/AST/Pass.h Sat Jul 7 18:59:33 2007
@@ -77,30 +77,6 @@
/// subclass to disambiguate the Node.
virtual void handle(Node* n);
- /// Handle a Block node. Subclasses should override this; default
- /// implementation does nothing.
- virtual void handle(Block* b);
-
- /// Handle a Bundle node. Subclasses should override this; default
- /// implementation does nothing.
- virtual void handle(Bundle* b);
-
- /// Handle a Function node. Subclasses should override this; default
- /// implementation does nothing.
- virtual void handle(Function* f);
-
- /// Handle a Program node. Subclasses should override this; default
- /// implementation does nothing.
- virtual void handle(Program* p);
-
- /// Handle a Operator node. Subclasses should override this; default
- /// implementation does nothing.
- virtual void handle(Operator* o);
-
- /// Handle a Type node. Subclasses should override this; default
- /// implementation does nothing.
- virtual void handle(Type* t);
-
/// @}
/// @name Invocators
/// @{
Added: hlvm/trunk/hlvm/AST/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/SConscript (added)
+++ hlvm/trunk/hlvm/AST/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,5 @@
+#
+import glob
+files = glob.glob('*.cpp')
+Import('env')
+env.Library('HLVMast',files)
Modified: hlvm/trunk/hlvm/AST/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/SymbolTable.cpp?rev=38071&r1=38070&r2=38071&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/SymbolTable.cpp (original)
+++ hlvm/trunk/hlvm/AST/SymbolTable.cpp Sat Jul 7 18:59:33 2007
@@ -28,10 +28,10 @@
//===----------------------------------------------------------------------===//
#include "hlvm/AST/SymbolTable.h"
+#include "hlvm/Base/Assert.h"
#include "llvm/ADT/StringExtras.h"
#include <iostream>
#include <algorithm>
-#include <cassert>
using namespace hlvm;
@@ -69,7 +69,7 @@
// remove - Remove a node from the symbol table...
Node* SymbolTable::erase(iterator Entry) {
- assert(Entry != map_.end() && "Invalid entry to remove!");
+ hlvmAssert(Entry != map_.end() && "Invalid entry to remove!");
const Node* Result = Entry->second;
map_.erase(Entry);
return const_cast<Node*>(Result);
@@ -77,7 +77,7 @@
// insert - Insert a node into the symbol table with the specified name...
void SymbolTable::insert(const std::string& Name, const Node* N) {
- assert(N && "Can't insert null node into symbol table!");
+ hlvmAssert(N && "Can't insert null node into symbol table!");
// Check to see if there is a naming conflict. If so, rename this type!
std::string unique_name = Name;
Added: hlvm/trunk/hlvm/Base/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Base/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Base/SConscript (added)
+++ hlvm/trunk/hlvm/Base/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,3 @@
+import glob
+files = glob.glob('*.cpp')
+Library('HLVMbase',files)
Modified: hlvm/trunk/hlvm/Makefile
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Makefile?rev=38071&r1=38070&r2=38071&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Makefile (original)
+++ hlvm/trunk/hlvm/Makefile Sat Jul 7 18:59:33 2007
@@ -7,6 +7,6 @@
#
# List all of the subdirectories that we will compile.
#
-DIRS=Base AST Reader Writer
+DIRS=Base AST Pass Reader Writer
include $(LEVEL)/Makefile.hlvm
Added: hlvm/trunk/hlvm/Reader/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Reader/SConscript (added)
+++ hlvm/trunk/hlvm/Reader/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,4 @@
+#
+SConscript([
+ 'XML/SConscript',
+])
Added: hlvm/trunk/hlvm/Reader/XML/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/SConscript (added)
+++ hlvm/trunk/hlvm/Reader/XML/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,3 @@
+import glob
+files = glob.glob('*.cpp')
+Library('HLVMXMLReader',files)
Added: hlvm/trunk/hlvm/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/hlvm/SConscript (added)
+++ hlvm/trunk/hlvm/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,7 @@
+#
+SConscript([
+ 'Base/SConscript',
+ 'AST/SConscript',
+ 'Reader/SConscript',
+ 'Writer/SConscript'
+])
Added: hlvm/trunk/hlvm/Writer/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Writer/SConscript (added)
+++ hlvm/trunk/hlvm/Writer/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,4 @@
+#
+SConscript([
+ 'XML/SConscript',
+])
Added: hlvm/trunk/hlvm/Writer/XML/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/XML/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Writer/XML/SConscript (added)
+++ hlvm/trunk/hlvm/Writer/XML/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,3 @@
+import glob
+files = glob.glob('*.cpp')
+Library('HLVMXMLWriter',files)
Added: hlvm/trunk/scons/__init__.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/__init__.py?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/scons/__init__.py (added)
+++ hlvm/trunk/scons/__init__.py Sat Jul 7 18:59:33 2007
@@ -0,0 +1,6 @@
+import os
+import glob
+import string
+__all__ = ["configure","default","environment"]
+__version__ = "0.1"
+__developer__ = "reid"
Added: hlvm/trunk/scons/configure.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/configure.py?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/scons/configure.py (added)
+++ hlvm/trunk/scons/configure.py Sat Jul 7 18:59:33 2007
@@ -0,0 +1,37 @@
+from SCons.Environment import Environment as Environment
+from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment
+
+def ConfigureHLVM(env):
+ conf = env.Configure()
+ CheckStdCXXHeaders(conf,env)
+ CheckForLibXML2(conf,env)
+ CheckForAPR(conf,env)
+ CheckForAPRU(conf,env)
+ CheckForLLVM(conf,env)
+ env = conf.Finish()
+
+def CheckStdCXXHeaders(env):
+ if not conf.CheckCXXHeader('vector'):
+ env.Exit(1)
+ if not conf.CheckCXXHeader('map'):
+ env.Exit(1)
+ if not conf.CheckCXXHeader('cassert'):
+ env.Exit(1)
+ if not conf.CheckCXXHeader('iostream'):
+ env.Exit(1)
+
+def CheckForLibXML2(conf,env):
+
+def CheckForAPR(conf,env):
+
+def CheckForAPRU(conf,env):
+
+def CheckForLLVM(conf,env):
+ if not conf.CheckLibWithHeader(
+ libs='LLVMCore',
+ header='llvm/Module.h',
+ language='c++',
+ call='llvm::Module* m = new llvm::Module("name")',
+ autoadd=1):
+ env.Exit(1)
+ return env
Added: hlvm/trunk/scons/environment.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/environment.py?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/scons/environment.py (added)
+++ hlvm/trunk/scons/environment.py Sat Jul 7 18:59:33 2007
@@ -0,0 +1,84 @@
+# HLVM scons Software Construction Specification
+#
+
+# Import stuff we need from SCons package
+from string import join
+from SCons.Options import Options as Options
+from SCons.Options import BoolOption as BoolOption
+from SCons.Environment import Environment as Environment
+from SCons.Script.SConscript import SConsEnvironment as SConsEnvironment
+
+def ProvisionEnvironment(env):
+ env.EnsurePythonVersion(2,3)
+ env.EnsureSConsVersion(0,96)
+ env.SetOption('implicit_cache',1)
+ env.TargetSignatures('build')
+ opts = Options('custom.py')
+ opts.AddOptions(
+ BoolOption('assrt','Include assertions in the code',1),
+ BoolOption('debug','Build with debug options turned on',1),
+ BoolOption('inline','Cause inline code to be inline',0),
+ BoolOption('optimize','Build object files with optimization',0),
+ BoolOption('profile','Generate profiling aware code',0),
+ BoolOption('small','Generate smaller code rather than faster',0),
+ BoolOption('config','Generation the configuration data',0)
+ )
+ opts.Update(env)
+ env['CC'] = 'gcc'
+ env['CCFLAGS'] = '-pipe -Wall -Wcast-align -Wpointer-arith'
+ env['CXXFLAGS'] = join([
+ "-pipe -Wall -Wcast-align -Wpointer-arith -Wno-deprecated -Wold-style-cast",
+ "-Woverloaded-virtual -ffor-scope -fno-operator-names"])
+ env['CPPDEFINES'] = { '__STDC_LIMIT_MACROS':None }
+ env.Prepend(CPPPATH='#')
+ VariantName=''
+ if env['small'] == 1:
+ VariantName='S'
+ env.Append(CCFLAGS='-Os')
+ env.Append(CXXFLAGS='-Os')
+ else :
+ VariantName='s'
+
+ if env['profile'] == 1:
+ VariantName+='P'
+ env.Append(CCFLAGS='-pg')
+ env.Append(CXXFLAGS='-pg')
+ else :
+ VariantName+='p'
+
+ if env['assrt'] == 1:
+ VariantName+='A'
+ env.Append(CPPDEFINES={'HLVM_ASSERT':None})
+ else :
+ VariantName+='a'
+
+ if env['debug'] == 1 :
+ VariantName += 'D'
+ env.Append(CCFLAGS='-g')
+ env.Append(CXXFLAGS='-g')
+ env.Append(CPPDEFINES={'HLVM_DEBUG':None})
+ else :
+ VariantName+='d'
+
+ if env['inline'] == 1:
+ VariantName+='I'
+ else :
+ VariantName+='i'
+ env.Append(CXXFLAGS='-fno-inline')
+
+ if env['optimize'] == 1 :
+ VariantName+='O'
+ env.APpend(CCFLAGS='-O3')
+ env.Append(CXXFLAGS='-O3')
+ else :
+ VariantName+='o'
+ env.Append(CCFLAGS='-O1')
+ env.Append(CXXFLAGS='-O1')
+
+ env['Variant'] = VariantName
+ env['BuildDir'] = 'build.'
+ env['BuildDir'] += VariantName
+
+ opts.Save('options.cache', env)
+ env.Help(opts.GenerateHelpText(env,sort=cmp))
+ return env;
Added: hlvm/trunk/scons/main.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/scons/main.py?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/scons/main.py (added)
+++ hlvm/trunk/scons/main.py Sat Jul 7 18:59:33 2007
@@ -0,0 +1,9 @@
+from SCons.Environment import Environment as Environment
+from environment import ProvisionEnvironment as ProvisionEnvironment
+def GetBuildEnvironment(targets):
+ env = Environment();
+ env = ProvisionEnvironment(env)
+ if env['config'] == 1:
+ from configure import ConfigureHLVM as ConfigureHLVM
+ env = ConfigureHLVM(env)
+ return env
Added: hlvm/trunk/tools/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/SConscript?rev=38071&view=auto
==============================================================================
--- hlvm/trunk/tools/SConscript (added)
+++ hlvm/trunk/tools/SConscript Sat Jul 7 18:59:33 2007
@@ -0,0 +1,3 @@
+SConscript([
+ 'hlvm-xml2xml/SConscript'
+])
More information about the llvm-commits
mailing list