Commit 81bcbf72 authored by Kunshan Wang's avatar Kunshan Wang

Parser and more dependencies.

parent 48de1b2c
......@@ -4,7 +4,11 @@
<classpathentry kind="src" path="src/test/scala"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="src" path="target/uir-parser-generated"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="lib/antlr-4.2-complete.jar"/>
<classpathentry kind="lib" path="lib/scalatest_2.11-2.2.0.jar"/>
<classpathentry kind="lib" path="lib/scala-parser-combinators_2.11-1.0.1.jar" sourcepath="lib/scala-parser-combinators_2.11-1.0.1-sources.jar"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="output" path="target/eclipsebuild"/>
</classpath>
Xcheck-null=false
Xcheckinit=false
Xdisable-assertions=false
Xelide-below=-2147483648
Xexperimental=false
Xfatal-warnings=false
Xfuture=false
Xlog-implicits=false
Xno-uescape=false
Ybuild-manager-debug=false
Yno-generic-signatures=false
Yno-imports=false
Ypresentation-debug=false
Ypresentation-delay=0
Ypresentation-verbose=false
Yrecursion=0
Yself-in-annots=false
Ystruct-dispatch=poly-cache
Ywarn-dead-code=false
buildmanager=sbt
compileorder=Mixed
debugIncremental=false
deprecation=false
eclipse.preferences.version=1
explaintypes=false
formatter.alignParameters=false
formatter.alignSingleLineCaseStatements=false
formatter.alignSingleLineCaseStatements.maxArrowIndent=40
formatter.compactControlReadability=false
formatter.compactStringConcatenation=false
formatter.doubleIndentClassDeclaration=false
formatter.formatXml=true
formatter.indentLocalDefs=false
formatter.indentPackageBlocks=true
formatter.indentSpaces=2
formatter.indentWithTabs=false
formatter.multilineScaladocCommentsStartOnFirstLine=false
formatter.placeScaladocAsterisksBeneathSecondAsterisk=false
formatter.preserveDanglingCloseParenthesis=false
formatter.preserveSpaceBeforeArguments=false
formatter.rewriteArrowSymbols=false
formatter.spaceBeforeColon=false
formatter.spaceInsideBrackets=false
formatter.spaceInsideParentheses=false
formatter.spacesWithinPatternBinders=true
g=vars
no-specialization=false
nowarn=false
optimise=false
organizeimports.expandcollapse=expand
organizeimports.groups=java$scala$org$com
organizeimports.scalapackage=false
organizeimports.wildcards=scalaz$scalaz.Scalaz
scala.compiler.useProjectSettings=false
stopBuildOnError=false
syntaxColouring.bracket.backgroundColourEnabled=false
syntaxColouring.bracket.bold=false
syntaxColouring.bracket.colour=0,0,0
syntaxColouring.bracket.enabled=true
syntaxColouring.bracket.italic=false
syntaxColouring.bracket.underline=false
syntaxColouring.default.backgroundColourEnabled=false
syntaxColouring.default.bold=false
syntaxColouring.default.colour=0,0,0
syntaxColouring.default.enabled=true
syntaxColouring.default.italic=false
syntaxColouring.default.underline=false
syntaxColouring.keyword.backgroundColourEnabled=false
syntaxColouring.keyword.bold=true
syntaxColouring.keyword.colour=127,0,85
syntaxColouring.keyword.enabled=true
syntaxColouring.keyword.italic=false
syntaxColouring.keyword.underline=false
syntaxColouring.numberLiteral.backgroundColourEnabled=false
syntaxColouring.numberLiteral.bold=false
syntaxColouring.numberLiteral.colour=196,140,255
syntaxColouring.numberLiteral.enabled=true
syntaxColouring.numberLiteral.italic=false
syntaxColouring.numberLiteral.underline=false
syntaxColouring.operator.backgroundColourEnabled=false
syntaxColouring.operator.bold=false
syntaxColouring.operator.colour=0,0,0
syntaxColouring.operator.enabled=true
syntaxColouring.operator.italic=false
syntaxColouring.operator.underline=false
syntaxColouring.scaladoc.backgroundColourEnabled=false
syntaxColouring.scaladoc.bold=false
syntaxColouring.scaladoc.colour=63,95,191
syntaxColouring.scaladoc.enabled=true
syntaxColouring.scaladoc.italic=false
syntaxColouring.scaladoc.underline=false
syntaxColouring.singleLineComment.backgroundColourEnabled=false
syntaxColouring.singleLineComment.bold=false
syntaxColouring.singleLineComment.colour=63,127,95
syntaxColouring.singleLineComment.enabled=true
syntaxColouring.singleLineComment.italic=false
syntaxColouring.singleLineComment.underline=false
syntaxColouring.string.backgroundColourEnabled=false
syntaxColouring.string.bold=false
syntaxColouring.string.colour=42,0,255
syntaxColouring.string.enabled=true
syntaxColouring.string.italic=false
syntaxColouring.string.underline=false
syntaxColouring.xml.attributeName.backgroundColourEnabled=false
syntaxColouring.xml.attributeName.bold=false
syntaxColouring.xml.attributeName.colour=127,0,127
syntaxColouring.xml.attributeName.enabled=true
syntaxColouring.xml.attributeName.italic=false
syntaxColouring.xml.attributeName.underline=false
syntaxColouring.xml.attributeValue.backgroundColourEnabled=false
syntaxColouring.xml.attributeValue.bold=false
syntaxColouring.xml.attributeValue.colour=42,0,255
syntaxColouring.xml.attributeValue.enabled=true
syntaxColouring.xml.attributeValue.italic=true
syntaxColouring.xml.attributeValue.underline=false
syntaxColouring.xml.comment.backgroundColourEnabled=false
syntaxColouring.xml.comment.bold=false
syntaxColouring.xml.comment.colour=63,85,191
syntaxColouring.xml.comment.enabled=true
syntaxColouring.xml.comment.italic=false
syntaxColouring.xml.comment.underline=false
syntaxColouring.xml.equals.backgroundColourEnabled=false
syntaxColouring.xml.equals.bold=false
syntaxColouring.xml.equals.colour=0,0,0
syntaxColouring.xml.equals.enabled=true
syntaxColouring.xml.equals.italic=false
syntaxColouring.xml.equals.underline=false
syntaxColouring.xml.processingInstruction.backgroundColourEnabled=false
syntaxColouring.xml.processingInstruction.bold=false
syntaxColouring.xml.processingInstruction.colour=0,128,128
syntaxColouring.xml.processingInstruction.enabled=true
syntaxColouring.xml.processingInstruction.italic=false
syntaxColouring.xml.processingInstruction.underline=false
syntaxColouring.xml.tagDelimiter.backgroundColourEnabled=false
syntaxColouring.xml.tagDelimiter.bold=false
syntaxColouring.xml.tagDelimiter.colour=0,128,128
syntaxColouring.xml.tagDelimiter.enabled=true
syntaxColouring.xml.tagDelimiter.italic=false
syntaxColouring.xml.tagDelimiter.underline=false
syntaxColouring.xml.tagName.backgroundColourEnabled=false
syntaxColouring.xml.tagName.bold=false
syntaxColouring.xml.tagName.colour=63,127,127
syntaxColouring.xml.tagName.enabled=true
syntaxColouring.xml.tagName.italic=false
syntaxColouring.xml.tagName.underline=false
target=jvm-1.6
unchecked=false
verbose=false
withVersionClasspathValidator=false
<project name="uvm-compiler" default="build" basedir=".">
<property name="antlr-jar" location="lib/antlr-4.2-complete.jar" />
<property name="uvm-dir" location="src" />
<property name="uir-rule" location="uIR.g4" />
<property name="uir-parser-package" value="uvm.ir.textinput.gen" />
<property name="uir-parser-path" value="uvm/ir/textinput/gen" />
<property name="uir-parser-generated" location="target/uir-parser-generated" />
<target name="build-uir-parser">
<echo message="Generating uIR parser from ${uir-rule} to ${uir-parser-generated}" />
<mkdir dir="${uir-parser-generated}" />
<java jar="${antlr-jar}" fork="true" failonerror="true">
<arg value="${uir-rule}" />
<arg line="-no-listener" />
<arg line="-package ${uir-parser-package}" />
<arg line="-o ${uir-parser-generated}/${uir-parser-path}/" />
</java>
</target>
<target name="clean">
<delete dir="${uir-parser-generated}" />
</target>
<target name="build" depends="build-uir-parser">
</target>
</project>
package uvm.ir.textinput
import uvm.UvmException
class TextIRParsingException(message: String = null, cause: Throwable = null) extends UvmException(message, cause)
\ No newline at end of file
This diff is collapsed.
package uvm.ir.textinput
import uvm._
import uvm.types._
import uvm.ssavalues._
object UvmIRReader {
import UvmIRAST._
def read(ir: CharSequence): Bundle = {
val ast = UvmIRParser(ir)
read(ast)
}
def read(ir: java.io.Reader): Bundle = {
val ast = UvmIRParser(ir)
read(ast)
}
def read(ast: IR): Bundle = {
null
}
}
\ No newline at end of file
......@@ -212,13 +212,13 @@ case class InstTailCall(var sig: FuncSig, var callee: Value, var args: Seq[Value
case class InstRet(var retTy: Type, var retVal: Value) extends AbstractRet
case class InstRetVoid extends AbstractRet
case class InstRetVoid() extends AbstractRet
case class InstThrow(var excVal: Value) extends Instruction {
def ty = VOID
}
case class InstLandingpad extends Instruction {
case class InstLandingpad() extends Instruction {
def ty = REFVOID
}
......
......@@ -21,11 +21,11 @@ case class TypeWeakRef(var ty: Type) extends AbstractRefType
case class TypeStruct(var fieldTy: Seq[Type]) extends Type
case class TypeArray(var elemTy: Type, var len: Long) extends Type
case class TypeHybrid(var fixedPart: Type, var varPart: Type) extends Type
case class TypeVoid extends Type
case class TypeVoid() extends Type
case class TypeFunc(var sig: FuncSig) extends Type
case class TypeThread() extends Type
case class TypeStack() extends Type
case class TypeTagRef64 extends Type
case class TypeTagRef64() extends Type
object Type {
def prettyPrint(ty: Type): String = ty match {
......
package uvm.ir.textinput
import collection.mutable.Stack
import org.scalatest._
class ExampleSpec extends FlatSpec with Matchers {
"A Stack" should "pop values in last-in-first-out order" in {
val stack = new Stack[Int]
stack.push(1)
stack.push(2)
stack.pop() should be (2)
stack.pop() should be (1)
}
it should "throw NoSuchElementException if an empty stack is popped" in {
val emptyStack = new Stack[Int]
a [NoSuchElementException] should be thrownBy {
emptyStack.pop()
}
}
}
\ No newline at end of file
#include <stdio.h>
int isPrime(long a) {
for (long i = 2; i < a; i++)
if (a % i == 0)
return 0;
return 1;
}
int main() {
int x = isPrime(1000000000000000001L);
printf("%d\n", x);
return 0;
}
; ModuleID = 'prime-number.c'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.7.0"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind readnone ssp uwtable
define i32 @isPrime(i64 %a) #0 {
entry:
%cmp5 = icmp sgt i64 %a, 2
br i1 %cmp5, label %for.body, label %return
for.cond: ; preds = %for.body
%cmp = icmp slt i64 %inc, %a
br i1 %cmp, label %for.body, label %return
for.body: ; preds = %entry, %for.cond
%i.06 = phi i64 [ %inc, %for.cond ], [ 2, %entry ]
%rem = srem i64 %a, %i.06
%cmp1 = icmp eq i64 %rem, 0
%inc = add nsw i64 %i.06, 1
br i1 %cmp1, label %return, label %for.cond
return: ; preds = %for.cond, %for.body, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 1, %for.cond ], [ 0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nounwind ssp uwtable
define i32 @main() #1 {
entry:
br label %for.body.i
for.cond.i: ; preds = %for.body.i
%cmp.i = icmp slt i64 %inc.i, 1000000000000000001
br i1 %cmp.i, label %for.body.i, label %isPrime.exit
for.body.i: ; preds = %for.cond.i, %entry
%i.06.i = phi i64 [ %inc.i, %for.cond.i ], [ 2, %entry ]
%rem.i = srem i64 1000000000000000001, %i.06.i
%cmp1.i = icmp eq i64 %rem.i, 0
%inc.i = add nsw i64 %i.06.i, 1
br i1 %cmp1.i, label %isPrime.exit, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %for.body.i
%retval.0.i = phi i32 [ 0, %for.body.i ], [ 1, %for.cond.i ]
%call1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %retval.0.i) #3
ret i32 0
}
; Function Attrs: nounwind
declare i32 @printf(i8* nocapture readonly, ...) #2
attributes #0 = { nounwind readnone ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { nounwind }
!llvm.ident = !{!0}
!0 = metadata !{metadata !"clang version 3.4 (tags/RELEASE_34/final)"}
// prime-number
.funcdef @isPrime <int<32> (int<64>)> (%a) {
%entry:
%cmp5 = SGT <int<64>> %a 2
BRANCH2 %cmp5 %for.body %return1
%for.cond:
%cmp = SLT <int<64>> %inc %a
BRANCH2 %cmp %for.body %return1
%for.body:
%i.06 = PHI <int<64>> {%for.cond:%inc ; %entry: 2;}
%rem = SREM <int<64>> %a %i.06
%cmp1 = EQ <int<64>> %rem 0
%inc = ADD <int<64>> %i.06 1
BRANCH2 %cmp1 %return0 %for.cond
%return1:
RET <int<32>> 1
%return0:
RET <int<32>> 0
}
.funcdef @main <int<32> ()> () {
%entry:
// empty so far
RET <int<32>> 0
}
\ No newline at end of file
.const @ci8 <int<8>> = 127
.const @ci16 <int<16>> = 32767
.const @ci32 <int<32>> = 2147483647
.const @ci64 <int<64>> = 9223372036854775807
.const @ci64neg <int<64>> = -42
.const @cio64 <int<64>> = 0777
.const @cix64 <int<64>> = 0x123456789abcdef0
.const @cixovf <int<64>> = 0xffffffffffffffff
.const @cixovf2 <int<64>> = 0x8000000000000000
.const @cf <float> = 3.14f
.const @cfnan <float> = nanf
.const @cfninf <float> = -inff
.const @cfpinf <float> = +inff
.const @cfbits <float> = bitsf(0x12345678)
.const @cd <double> = 6.28d
.const @cdnan <double> = nand
.const @cdninf <double> = -infd
.const @cdpinf <double> = +infd
.const @cdbits <double> = bitsd(0xfedcba9876543210)
.const @cs1 <struct<int<64> double>> = {100 200.0d}
.const @cs2 <struct<double struct<float int<64>> int<32>>> = {1.0d {2.0f 3} 4}
.const @cons <@Cons> = {42 NULL}
.typedef @Cons = struct<int<64> ref<@Cons>>
.const @cr <ref<int<64>>> = NULL
.const @cir <iref<float>> = NULL
.const @cwr <weakref<@Cons>>= NULL
.const @cfu <func<void ()>> = NULL
.const @cth <thread> = NULL
.const @cst <stack> = NULL
.const @sgf <struct<iref<int<64>> func<void ()>>> = {@gi64 @fdummy}
.global @gi64 <int<64>>
.funcdecl @fdummy <void ()>
.funcsig @foo = void ()
.funcsig @bar = int<64> (int<32> int<16>)
.funcsig @baz = int<32> (int<32> iref<iref<int<8>>>)
.funcsig @sig_fs = void (int<32>)
.typedef @sig_t = func<@sig_fs>
.funcdecl @signal <@sig_t (int<32> @sig_t)>
.const @zero <int<32>> = 0
.funcdef @main <@baz> (%argc %argv) {
%entry:
RET <int<32>> @zero
}
.funcdef @implicitentry <@foo> () {
RET <int<32>> @zero
}
.funcdef @intBinOpTest <void (int<32> int<32>)> (%p0 %p1) {
%add = ADD <int<32>> %p0 %p1
%sub = SUB <int<32>> %p0 %p1
%mul = MUL <int<32>> %p0 %p1
%udiv = UDIV <int<32>> %p0 %p1
%sdiv = SDIV <int<32>> %p0 %p1
%urem = UREM <int<32>> %p0 %p1
%srem = SREM <int<32>> %p0 %p1
%shl = SHL <int<32>> %p0 %p1
%lshr = LSHR <int<32>> %p0 %p1
%ashr = ASHR <int<32>> %p0 %p1
%and = AND <int<32>> %p0 %p1
%or = OR <int<32>> %p0 %p1
%xor = XOR <int<32>> %p0 %p1
RETVOID
}
.funcdef @fpBinOpTest <void (double double)> (%p0 %p1) {
%fadd = FADD <double> %p0 %p1
%fsub = FSUB <double> %p0 %p1
%fmul = FMUL <double> %p0 %p1
%fdiv = FDIV <double> %p0 %p1
%frem = FREM <double> %p0 %p1
RETVOID
}
.funcdef @intCmpTest <void (int<64> int<64>)> (%p0 %p1) {
%eq = EQ <int<64>> %p0 %p1
%ne = NE <int<64>> %p0 %p1
%ult = ULT <int<64>> %p0 %p1
%ule = ULE <int<64>> %p0 %p1
%ugt = UGT <int<64>> %p0 %p1
%uge = UGE <int<64>> %p0 %p1
%slt = SLT <int<64>> %p0 %p1
%sle = SLE <int<64>> %p0 %p1
%sgt = SGT <int<64>> %p0 %p1
%sge = SGE <int<64>> %p0 %p1
RETVOID
}
.funcdef @fpCmpTest <void (float float)> (%p0 %p1) {
%ftrue = FTRUE <float> %p0 %p1
%ffalse = FFALSE <float> %p0 %p1
%ford = FORD <float> %p0 %p1
%foeq = FOEQ <float> %p0 %p1
%fone = FONE <float> %p0 %p1
%folt = FOLT <float> %p0 %p1
%fole = FOLE <float> %p0 %p1
%fogt = FOGT <float> %p0 %p1
%foge = FOGE <float> %p0 %p1
%funo = FUNO <float> %p0 %p1
%fueq = FUEQ <float> %p0 %p1
%fune = FUNE <float> %p0 %p1
%fult = FULT <float> %p0 %p1
%fule = FULE <float> %p0 %p1
%fugt = FUGT <float> %p0 %p1
%fuge = FUGE <float> %p0 %p1
RETVOID
}
.funcdef @convTest <void (int<32> int<64> float double)> (%p0 %p1 %p2 %p3) {
%trunc = TRUNC <int<64> int<32>> %p1
%zext = ZEXT <int<32> int<64>> %p0
%sext = SEXT <int<32> int<64>> %p0
%fptrunc = FPTRUNC <double float> %p3
%fpext = FPEXT <float double> %p2
%fptoui = FPTOUI <double int<64>> %p3
%fptosi = FPTOSI <double int<64>> %p3
%uitofp = UITOFP <int<64> double> %p1
%sitofp = SITOFP <int<64> double> %p1
%bitcast0 = BITCAST <int<32> float> %p0
%bitcast1 = BITCAST <int<64> double> %p1
%bitcast2 = BITCAST <float int<32>> %p2
%bitcast3 = BITCAST <double int<64>> %p3
RETVOID
}
.funcdef @refCastTest <void (ref<void> iref<void> func<void ()>)> (%p0 %p1 %p2) {
%refcast = REFCAST <ref<void> ref<int<32>>> %p0
%irefcast = IREFCAST <iref<void> iref<int<64>>> %p1
%funccast = FUNCCAST <func<void()> func<@iiisig>> %p2
RETVOID
}
.funcdef @ctrlFlow <void (int<32>)> (%p0) {
%entry:
%br1 = BRANCH %head
%head:
%phi = PHI <int<32>> { %entry: 0; %next: %i2; }
%zero = EQ <int<32>> %p0 0
%br2 = BRANCH2 %zero %body %exit
%body:
%switch = SWITCH <int<32>> %phi %other { 1: %one; 2: %two; }
%one:
%br3 = BRANCH %next
%two:
%br4 = BRANCH %next
%other:
%br5 = BRANCH %next
%next:
%i2 = SUB <int<32>> %phi 1
%br6 = BRANCH %head
%exit:
RETVOID
}
.funcsig @iiisig = int<64> (int<64> int<64>)
.funcdecl @callee1 <void ()>
.funcdef @callee2 <@iiisig> (%p0 %p1) {
%rv = ADD <int<64>> %p0 %p1
%ret = RET <int<64>> %rv
}
.funcdef @callee3 <@iiisig> (%p0 %p1) {
%exc = NEW <double>
%throw = THROW %exc
}
.funcdef @caller1 <void ()> () {
%v1 = CALL <void ()> @callee1 ()
%v2 = CALL <@iiisig> @callee2 (1 2)
%v3 = INVOKE <@iiisig> @callee3 (3 4) %cont %catch
%cont:
%v4 = CALL <void ()> @callee1 () KEEPALIVE (%v2 %v3)
%v5 = INVOKE <@iiisig> @callee3 (%v3 %v3) %cont2 %catch KEEPALIVE (%v2)
%cont2:
%retv = RETVOID
%catch:
%exc = LANDINGPAD
RETVOID
}
.funcdef @caller2 <@iiisig> (%p0 %p1) {
%tc = TAILCALL <@iiisig> @callee2 (%p0 %p1)
}
.typedef @sid = struct <int<64> double>
.const @sid1 <@sid> = {42 3.14d}
.funcdef @aggregate <void ()> () {
%e0 = EXTRACTVALUE <@sid 0> @sid1
%e1 = EXTRACTVALUE <@sid 1> @sid1
%i0 = INSERTVALUE <@sid 0> @sid1 40
%i1 = INSERTVALUE <@sid 1> @sid1 40.0d
RETVOID
}
.typedef @al = array <int<64> 10>
.typedef @hic = hybrid <int<64> int<8>>
.funcdef @memops <void (int<64> int<64>)> (%p0 %p1) {
%new = NEW <int<64>>
%newhybrid = NEWHYBRID <@hic> %p0
%alloca = ALLOCA <int<64>>
%allocahybrid = ALLOCAHYBRID <@hic> %p0
%new2 = NEW <@sid>
%alloca2 = ALLOCA <@al>
%getiref = GETIREF <@sid> %new2
%getfieldiref = GETFIELDIREF <@sid 0> %getiref
%getelemiref = GETELEMIREF <@al> %alloca2 %p1
%getfixedpartiref = GETFIXEDPARTIREF <@hic> %allocahybrid
%getvarpartiref = GETVARPARTIREF <@hic> %allocahybrid
%shiftiref = SHIFTIREF <int<8>> %getvarpartiref %p1
%load = LOAD <int<64>> %alloca
%store = STORE <int<64>> %alloca 42
%cmpxchg = CMPXCHG ACQUIRE MONOTONIC <int<64>> %alloca 42 0
%atomicrmw = ATOMICRMW ACQ_REL ADD <int<64>> %alloca 50
%fence = FENCE MONOTONIC
RETVOID
}
.funcdef @memorder <void (iref<int<64>>)> (%p0) {
%l0 = LOAD NOT_ATOMIC <int<64>> %p0
%l1 = LOAD UNORDERED <int<64>> %p0
%l2 = LOAD MONOTONIC <int<64>> %p0
%f3 = FENCE ACQUIRE
%f4 = FENCE RELEASE
%f5 = FENCE ACQ_REL
%l6 = LOAD SEQ_CST <int<64>> %p0
RETVOID
}
.funcdef @atomicrmwops <void (iref<int<64>> int<64>)> (%p0 %p1) {
%old0 = ATOMICRMW ACQ_REL XCHG <int<64>> %p0 %p1
%old1 = ATOMICRMW ACQ_REL ADD <int<64>> %p0 %p1
%old2 = ATOMICRMW ACQ_REL SUB <int<64>> %p0 %p1
%old3 = ATOMICRMW ACQ_REL AND <int<64>> %p0 %p1
%old4 = ATOMICRMW ACQ_REL NAND <int<64>> %p0 %p1
%old5 = ATOMICRMW ACQ_REL OR <int<64>> %p0 %p1
%old6 = ATOMICRMW ACQ_REL XOR <int<64>> %p0 %p1
%old7 = ATOMICRMW ACQ_REL MAX <int<64>> %p0 %p1
%old8 = ATOMICRMW ACQ_REL MIN <int<64>> %p0 %p1
%old9 = ATOMICRMW ACQ_REL UMAX <int<64>> %p0 %p1
%olda = ATOMICRMW ACQ_REL UMIN <int<64>> %p0 %p1
RETVOID
}
.funcdef @traps <void ()> () {
%a = ADD <int<64>> 30 40
%b = SUB <int<64>> 30 40
%c = MUL <int<64>> 30 40
%wp = WATCHPOINT 1 <int<64>> %body %wpcont %wpexc KEEPALIVE (%a)
%body:
%tp = TRAP <int<32>> %trapcont %trapexc KEEPALIVE (%b %wp)
%wpcont:
RETVOID
%wpexc:
%exc = LANDINGPAD
THROW %exc
%trapcont:
RETVOID
%trapexc:
%exc2 = LANDINGPAD
THROW %exc2
}
.funcdef @ccall <void (int<64>)> (%p0) {
%rv = CCALL DEFAULT <void (double)> %p0 (3.14d)
RETVOID
}
.global @globalexc <ref<int<64>>>
.funcdef @stack_and_intrinsic <void (int<64>)> (%p0) {
%a = ADD <int<64>> 30 40
%b = SUB <int<64>> 30 40
%c = MUL <int<64>> 30 40
%ns = NEWSTACK <@iiisig> @callee2 (5 6)
%i = ICALL @uvm.swap_stack(%ns) KEEPALIVE (%b)
%j = IINVOKE @uvm.kill_stack(%ns) %nor %exc KEEPALIVE (%b %c)
%nor:
RETVOID
%exc:
%the_exc = LOAD <ref<int<64>>> @globalexc
THROW %the_exc
}
.funcsig @rainbow_sig = float (int<8> int<16> int<32> int<64> float double)
.funcdecl @rainbow <@rainbow_sig>