summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/code_generator.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-07-04 09:41:32 +0100
committerNicolas Geoffray <ngeoffray@google.com>2014-07-14 10:06:11 +0100
commite50383288a75244255d3ecedcc79ffe9caf774cb (patch)
tree8858489463a57c7b50f7db4d972abec21302b7a7 /compiler/optimizing/code_generator.h
parentcf90ba7ebe00346651f3b7ce1e5b1f785f7caabd (diff)
downloadart-e50383288a75244255d3ecedcc79ffe9caf774cb.tar.gz
art-e50383288a75244255d3ecedcc79ffe9caf774cb.tar.bz2
art-e50383288a75244255d3ecedcc79ffe9caf774cb.zip
Support fields in optimizing compiler.
- Required support for temporaries, to be only used by baseline compiler. - Also fixed a few invalid assumptions around locations and instructions that don't need materialization. These instructions should not have an Out. Change-Id: Idc4a30dd95dd18015137300d36bec55fc024cf62
Diffstat (limited to 'compiler/optimizing/code_generator.h')
-rw-r--r--compiler/optimizing/code_generator.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index ae2f03080e..abfb790d8f 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -30,12 +30,13 @@ namespace art {
static size_t constexpr kVRegSize = 4;
static size_t constexpr kUninitializedFrameSize = 0;
+class CodeGenerator;
class DexCompilationUnit;
class CodeAllocator {
public:
- CodeAllocator() { }
- virtual ~CodeAllocator() { }
+ CodeAllocator() {}
+ virtual ~CodeAllocator() {}
virtual uint8_t* Allocate(size_t size) = 0;
@@ -48,6 +49,23 @@ struct PcInfo {
uintptr_t native_pc;
};
+class SlowPathCode : public ArenaObject {
+ public:
+ SlowPathCode() : entry_label_(), exit_label_() {}
+ virtual ~SlowPathCode() {}
+
+ Label* GetEntryLabel() { return &entry_label_; }
+ Label* GetExitLabel() { return &exit_label_; }
+
+ virtual void EmitNativeCode(CodeGenerator* codegen) = 0;
+
+ private:
+ Label entry_label_;
+ Label exit_label_;
+
+ DISALLOW_COPY_AND_ASSIGN(SlowPathCode);
+};
+
class CodeGenerator : public ArenaObject {
public:
// Compiles the graph to executable instructions. Returns whether the compilation
@@ -99,6 +117,12 @@ class CodeGenerator : public ArenaObject {
pc_infos_.Add(pc_info);
}
+ void AddSlowPath(SlowPathCode* slow_path) {
+ slow_paths_.Add(slow_path);
+ }
+
+ void GenerateSlowPaths();
+
void BuildMappingTable(std::vector<uint8_t>* vector) const;
void BuildVMapTable(std::vector<uint8_t>* vector) const;
void BuildNativeGCMap(
@@ -110,6 +134,7 @@ class CodeGenerator : public ArenaObject {
graph_(graph),
block_labels_(graph->GetArena(), 0),
pc_infos_(graph->GetArena(), 32),
+ slow_paths_(graph->GetArena(), 8),
blocked_registers_(graph->GetArena()->AllocArray<bool>(number_of_registers)) {}
~CodeGenerator() {}
@@ -125,6 +150,7 @@ class CodeGenerator : public ArenaObject {
size_t AllocateFreeRegisterInternal(bool* blocked_registers, size_t number_of_registers) const;
virtual Location GetStackLocation(HLoadLocal* load) const = 0;
+ virtual Location GetTemporaryLocation(HTemporary* temp) const = 0;
// Frame size required for this method.
uint32_t frame_size_;
@@ -138,6 +164,7 @@ class CodeGenerator : public ArenaObject {
// Labels for each block that will be compiled.
GrowableArray<Label> block_labels_;
GrowableArray<PcInfo> pc_infos_;
+ GrowableArray<SlowPathCode*> slow_paths_;
// Temporary data structure used when doing register allocation.
bool* const blocked_registers_;