comparison graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java @ 13227:1a66453f73db

renamed TargetMethodAssembler to CompilationResultBuilder
author Doug Simon <doug.simon@oracle.com>
date Tue, 03 Dec 2013 10:51:16 +0100
parents d3fc35a43376
children 325b4e4efb60
comparison
equal deleted inserted replaced
13226:0b4d38339708 13227:1a66453f73db
93 } 93 }
94 94
95 class HotSpotFrameContext implements FrameContext { 95 class HotSpotFrameContext implements FrameContext {
96 96
97 @Override 97 @Override
98 public void enter(TargetMethodAssembler tasm) { 98 public void enter(CompilationResultBuilder crb) {
99 Debug.log("Nothing to do here"); 99 Debug.log("Nothing to do here");
100 } 100 }
101 101
102 @Override 102 @Override
103 public void leave(TargetMethodAssembler tasm) { 103 public void leave(CompilationResultBuilder crb) {
104 Debug.log("Nothing to do here"); 104 Debug.log("Nothing to do here");
105 } 105 }
106 } 106 }
107 107
108 @Override 108 @Override
109 protected AbstractAssembler createAssembler(FrameMap frameMap) { 109 protected AbstractAssembler createAssembler(FrameMap frameMap) {
110 return new HSAILAssembler(getTarget()); 110 return new HSAILAssembler(getTarget());
111 } 111 }
112 112
113 @Override 113 @Override
114 public TargetMethodAssembler newAssembler(LIRGenerator lirGen, CompilationResult compilationResult) { 114 public CompilationResultBuilder newCompilationResultBuilder(LIRGenerator lirGen, CompilationResult compilationResult) {
115 FrameMap frameMap = lirGen.frameMap; 115 FrameMap frameMap = lirGen.frameMap;
116 AbstractAssembler masm = createAssembler(frameMap); 116 AbstractAssembler masm = createAssembler(frameMap);
117 HotSpotFrameContext frameContext = new HotSpotFrameContext(); 117 HotSpotFrameContext frameContext = new HotSpotFrameContext();
118 TargetMethodAssembler tasm = new TargetMethodAssembler(getCodeCache(), getForeignCalls(), frameMap, masm, frameContext, compilationResult); 118 CompilationResultBuilder crb = new CompilationResultBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, frameContext, compilationResult);
119 tasm.setFrameSize(frameMap.frameSize()); 119 crb.setFrameSize(frameMap.frameSize());
120 return tasm; 120 return crb;
121 } 121 }
122 122
123 @Override 123 @Override
124 public void emitCode(TargetMethodAssembler tasm, LIRGenerator lirGen, ResolvedJavaMethod method) { 124 public void emitCode(CompilationResultBuilder crb, LIRGenerator lirGen, ResolvedJavaMethod method) {
125 assert method != null : lirGen.getGraph() + " is not associated with a method"; 125 assert method != null : lirGen.getGraph() + " is not associated with a method";
126 // Emit the prologue. 126 // Emit the prologue.
127 codeBuffer = tasm.asm.codeBuffer; 127 codeBuffer = crb.asm.codeBuffer;
128 codeBuffer.emitString0("version 0:95: $full : $large;"); 128 codeBuffer.emitString0("version 0:95: $full : $large;");
129 codeBuffer.emitString(""); 129 codeBuffer.emitString("");
130 130
131 Signature signature = method.getSignature(); 131 Signature signature = method.getSignature();
132 int sigParamCount = signature.getParameterCount(false); 132 int sigParamCount = signature.getParameterCount(false);
174 codeBuffer.emitString0("// " + (isStatic ? "static" : "instance") + " method " + method); 174 codeBuffer.emitString0("// " + (isStatic ? "static" : "instance") + " method " + method);
175 codeBuffer.emitString(""); 175 codeBuffer.emitString("");
176 codeBuffer.emitString0("kernel &run ("); 176 codeBuffer.emitString0("kernel &run (");
177 codeBuffer.emitString(""); 177 codeBuffer.emitString("");
178 178
179 FrameMap frameMap = tasm.frameMap; 179 FrameMap frameMap = crb.frameMap;
180 RegisterConfig regConfig = frameMap.registerConfig; 180 RegisterConfig regConfig = frameMap.registerConfig;
181 // Build list of param types which does include the gid (for cc register mapping query). 181 // Build list of param types which does include the gid (for cc register mapping query).
182 JavaType[] ccParamTypes = new JavaType[nonConstantParamCount + 1]; 182 JavaType[] ccParamTypes = new JavaType[nonConstantParamCount + 1];
183 // Include the gid. 183 // Include the gid.
184 System.arraycopy(paramtypes, 0, ccParamTypes, 0, nonConstantParamCount); 184 System.arraycopy(paramtypes, 0, ccParamTypes, 0, nonConstantParamCount);
278 } else { 278 } else {
279 codeBuffer.emitString("ld_global_u64 " + iterationObjArgReg + ", " + "[" + tmpReg + "]" + "; // Load from array element into parameter reg"); 279 codeBuffer.emitString("ld_global_u64 " + iterationObjArgReg + ", " + "[" + tmpReg + "]" + "; // Load from array element into parameter reg");
280 } 280 }
281 } 281 }
282 // Prologue done, Emit code for the LIR. 282 // Prologue done, Emit code for the LIR.
283 lirGen.lir.emitCode(tasm); 283 lirGen.lir.emitCode(crb);
284 // Now that code is emitted go back and figure out what the upper Bound stack size was. 284 // Now that code is emitted go back and figure out what the upper Bound stack size was.
285 long maxStackSize = ((HSAILAssembler) tasm.asm).upperBoundStackSize(); 285 long maxStackSize = ((HSAILAssembler) crb.asm).upperBoundStackSize();
286 String spillsegStringFinal; 286 String spillsegStringFinal;
287 if (maxStackSize == 0) { 287 if (maxStackSize == 0) {
288 // If no spilling, get rid of spillseg declaration. 288 // If no spilling, get rid of spillseg declaration.
289 char[] array = new char[spillsegTemplate.length()]; 289 char[] array = new char[spillsegTemplate.length()];
290 Arrays.fill(array, ' '); 290 Arrays.fill(array, ' ');