1. Jason S
  2. llvm-testcases

Commits

Jason S  committed fffa2da

minor refactoring, 2nd failed testcase

  • Participants
  • Parent commits fc2b945
  • Branches default

Comments (0)

Files changed (2)

File opt1/src/main.cpp

View file
     foo.setValue(foo.fib(foo.getValue()));
 }
 
+int getfact(Foo& foo)
+{
+    return foo.factorial(foo.getValue());
+}
+
 int main(int argc, char **argv)
 {
 	bar1.setValue(5);
 	bar2.setValue(5);
 	bar1.setValue(bar1.fib(bar1.getValue()));
-	//fibify(bar2);
+	// fibify(bar2);
 	printf("bar1.getValue() = %d\n", bar1.getValue());
 	printf("bar2.getValue() = %d\n", bar2.getValue());
 	printf("bar1.factorial(bar1.getValue()) = %d\n",
 	    bar1.factorial(bar1.getValue()));
+	// printf("getfact(bar1) = %d\n", getfact(bar1));
 	return 0;
 }

File opt1/src/wscript

View file
  pass
 
 
-def link_and_build(ctx, modules, output_base):
+def link_bitcode(ctx, modules, output_base):
  ctx(rule='${LLVM_LD} ${SRC} -b ${TGT}', source=[name+'.bc' for name in modules], target=[output_base+'.bc'])
+ 
+def use_bitcode(ctx, output_base):
  ctx(rule='${LLVM_DIS} ${SRC} -o=${TGT}', source=output_base+'.bc', target=output_base+'.ll')
  ctx(rule='${LLC} -O=3 ${SRC} -o ${TGT}', source=output_base+'.bc', target=output_base+'.s')
- ctx(rule='${CLANG} ${SRC} -o ${TGT}', source=output_base+'.s', target=output_base)
+ ctx(rule='${CLANG} ${SRC} -o ${TGT}', source=output_base+'.bc', target=output_base)
 
 def build(ctx):
  print ctx.env.CLANG
  modules = ('Foo', 'Bar', 'main')
  for name in modules:
        ctx(rule='${CLANG} ${CXXFLAGS} -c ${SRC} -o ${TGT}', source=name+'.cpp', target=name+'.bc')
- link_and_build(ctx, modules, 'opt1')
+ link_bitcode(ctx, modules, 'opt1')
+ use_bitcode(ctx, 'opt1')