From f1a0c25fee832b93768b5e7daaf0f71dd78c43fd Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 16 Feb 2006 09:15:33 +0000 Subject: [PATCH] Flat node classes --- Robust/src/IR/Flat/FlatCondBranch.java | 22 ++++++++++++++++++++++ Robust/src/IR/Flat/FlatNop.java | 11 +++++++++++ Robust/src/IR/Flat/TempDescriptor.java | 25 +++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 Robust/src/IR/Flat/FlatCondBranch.java create mode 100644 Robust/src/IR/Flat/FlatNop.java create mode 100644 Robust/src/IR/Flat/TempDescriptor.java diff --git a/Robust/src/IR/Flat/FlatCondBranch.java b/Robust/src/IR/Flat/FlatCondBranch.java new file mode 100644 index 00000000..fa0f9817 --- /dev/null +++ b/Robust/src/IR/Flat/FlatCondBranch.java @@ -0,0 +1,22 @@ +package IR.Flat; +import java.util.Vector; + +public class FlatCondBranch extends FlatNode { + TempDescriptor test_cond; + + public FlatCondBranch(TempDescriptor td) { + test_cond=td; + } + + public void addTrueNext(FlatNode n) { + next.setElementAt(n,0); + } + + public void addFalseNext(FlatNode n) { + next.setElementAt(n,1); + } + + public void addNext(FlatNode n) { + throw new Error(); + } +} diff --git a/Robust/src/IR/Flat/FlatNop.java b/Robust/src/IR/Flat/FlatNop.java new file mode 100644 index 00000000..62fad291 --- /dev/null +++ b/Robust/src/IR/Flat/FlatNop.java @@ -0,0 +1,11 @@ +package IR.Flat; +import java.util.Vector; + +public class FlatNop extends FlatNode { + public FlatNop() { + } + + public String toString() { + return "nop"; + } +} diff --git a/Robust/src/IR/Flat/TempDescriptor.java b/Robust/src/IR/Flat/TempDescriptor.java new file mode 100644 index 00000000..8cff4119 --- /dev/null +++ b/Robust/src/IR/Flat/TempDescriptor.java @@ -0,0 +1,25 @@ +package IR.Flat; +import IR.*; + +public class TempDescriptor { + static int currentid=0; + int id; + String safename; + + public TempDescriptor(String name) { + safename="__"+name+"__"; + id=currentid++; + } + + public static TempDescriptor tempFactory() { + return new TempDescriptor("temp_"+currentid); + } + + public static TempDescriptor tempFactory(String name) { + return new TempDescriptor(name+currentid); + } + + public String toString() { + return safename; + } +} -- 2.34.1